71 lines · plain
1! RUN: %python %S/test_errors.py %s %flang_fc12! Every other Fortran compiler (but one) interprets the names of parent3! components like this when the names of their types are the product of4! USE association with renaming.5 6module m17 type originalName8 integer m9 end type10end11 12module m213 use m1, newName => originalName14 type, extends(newName) :: extended15 integer n16 end type17 type, extends(newName) :: extended218 integer originalName ! ok19 end type20 contains21 subroutine s122 type(extended) x23 type(extended2) x224 print *, x%newName%m ! ok25 !ERROR: Component 'originalname' not found in derived type 'extended'26 print *, x%originalName27 print *, extended(newName=newName(m=1),n=2) ! ok28 !ERROR: Structure constructor lacks a value for component 'm'29 !ERROR: Keyword 'originalname=' does not name a component of derived type 'extended'30 !ERROR: Keyword 'm=' may not appear in a reference to a procedure with an implicit interface31 print *, extended(originalName=originalName(m=1),n=2)32 !ERROR: Value in structure constructor of type 'REAL(4)' is incompatible with component 'newname' of type 'newname'33 !ERROR: Keyword 'm=' may not appear in a reference to a procedure with an implicit interface34 print *, extended(newName=originalName(m=1),n=2)35 !ERROR: Structure constructor lacks a value for component 'm'36 !ERROR: Keyword 'originalname=' does not name a component of derived type 'extended'37 print *, extended(originalName=newName(m=1),n=2)38 print *, x2%newName%m ! ok39 print *, x2%originalName ! ok40 print *, extended2(newName=newName(m=1),originalName=2) ! ok41 end42end43 44module m345 use m246 contains47 ! Same as above, but not in the same module as the derived48 ! types' definitions.49 subroutine s250 type(extended) x51 type(extended2) x252 print *, x%newName%m ! ok53 !ERROR: Component 'originalname' not found in derived type 'extended'54 print *, x%originalName55 print *, extended(newName=newName(m=1),n=2) ! ok56 !ERROR: Structure constructor lacks a value for component 'm'57 !ERROR: Keyword 'originalname=' does not name a component of derived type 'extended'58 !ERROR: Keyword 'm=' may not appear in a reference to a procedure with an implicit interface59 print *, extended(originalName=originalName(m=1),n=2)60 !ERROR: Value in structure constructor of type 'REAL(4)' is incompatible with component 'newname' of type 'newname'61 !ERROR: Keyword 'm=' may not appear in a reference to a procedure with an implicit interface62 print *, extended(newName=originalName(m=1),n=2)63 !ERROR: Structure constructor lacks a value for component 'm'64 !ERROR: Keyword 'originalname=' does not name a component of derived type 'extended'65 print *, extended(originalName=newName(m=1),n=2)66 print *, x2%newName%m ! ok67 print *, x2%originalName ! ok68 print *, extended2(newName=newName(m=1),originalName=2) ! ok69 end70end71