2 ! This checks the fix for PR19362 in which types from different scopes
3 ! that are the same, according to 4.4.2, would generate an ICE if one
4 ! were assigned to the other. As well as the test itself, various
5 ! other requirements of 4.4.2 are tested here.
7 ! Contributed by Paul Thomas <pault@gcc.gnu.org>
19 type (nonseq_type1
) :: ns1
23 ! Host types with local name != true name
24 use global
, only
: seq_type2
=>seq_type1
, nonseq_type2
=>nonseq_type1
, ns1
25 type (nonseq_type2
) :: ns2
27 ! Host non-sequence types
28 type :: different_type
30 end type different_type
31 type (different_type
) :: dt1
36 type (same_type
) :: st1
40 ! Provide a reference to dt1.
41 dt1
= different_type (42)
42 ! These share a type declaration.
44 ! USE associated seq_type1 is renamed.
47 ! These are different.
48 st1
= dt
! { dg-error "convert REAL" }
50 call foo (st1
) ! { dg-error "Type mismatch in argument" }
56 ! Contained type with local name != true name.
57 ! This is the same as seq_type2 in the host.
58 use global
, only
: seq_type3
=>seq_type1
60 ! This local declaration is the same as seq_type3 and seq_type2.
66 ! Host association of renamed type.
68 ! Locally declared version of the same thing.
70 ! USE associated renamed type.
73 ! Contained type that is different to that in the host.
74 type :: different_type
76 end type different_type
82 type (different_type
) :: b
83 type (same_type
) :: st2
85 ! Error because these are not the same.
86 b
= dt1
! { dg-error "convert TYPE" }
88 ! Error in spite of the name - these are non-sequence types and are NOT
90 st1
= st2
! { dg-error "convert TYPE" }
94 ! Check that the references that are correct actually work. These test the
102 ! { dg-final { cleanup-modules "global" } }