3 ! PR 46330: [4.6 Regression] [OOP] ICE after revision 166368
5 ! Contributed by Dominique d'Humieres <dominiq@lps.ens.fr>
6 ! Taken from http://groups.google.com/group/comp.lang.fortran/browse_thread/thread/76f99e7fd4f3e772
10 type, abstract :: Type2
14 module extended2A_type
17 type, extends(Type2) :: Extended2A
18 real(kind(1.0D0)) :: coeff1 = 1.
20 procedure :: setCoeff1 => Extended2A_setCoeff1
23 function Extended2A_new(c1, c2) result(typePtr_)
24 real(kind(1.0D0)), optional, intent(in) :: c1
25 real(kind(1.0D0)), optional, intent(in) :: c2
26 type(Extended2A), pointer :: typePtr_
27 type(Extended2A), save, allocatable, target :: type_
30 if (present(c1)) call type_%setCoeff1(c1)
32 if ( .not.(associated (typePtr_))) then
33 stop 'Error initializing Extended2A Pointer.'
35 end function Extended2A_new
36 subroutine Extended2A_setCoeff1(this,c1)
37 class(Extended2A) :: this
38 real(kind(1.0D0)), intent(in) :: c1
40 end subroutine Extended2A_setCoeff1
41 end module extended2A_type
47 class(type2), pointer :: type2Ptr => null()
49 procedure :: initProc => Type1_initProc
52 function Type1_initProc(this) result(iError)
57 this% type2Ptr => extended2A_new()
58 if ( .not.( associated(this% type2Ptr))) then
60 write(*,'(A)') "Something Wrong."
64 end function Type1_initProc