2 ! { dg-options "-std=f95" }
4 ! PR20901 - Checks resolution of types in EQUIVALENCE statement when
5 ! f95 standard is imposed.
7 ! Contributed by Paul Thomas <pault@gcc.gnu.org>
18 type (numeric_type
) :: my_num
, thy_num
27 end type numeric_type2
29 type (numeric_type2
) :: his_num
34 character*4 :: cha (6)
37 type (char_type
) :: my_char
42 character*4 :: cha (6)
45 type (mixed_type
) :: my_mixed
, thy_mixed
47 character(len
=4) :: ch
49 integer(kind
=8) :: non_def
50 complex(kind
=8) :: my_z
, thy_z
52 ! Permitted: character with character sequence
53 ! numeric with numeric sequence
54 ! numeric sequence with numeric sequence
55 ! non-default of same type
56 ! mixed sequences of same type
57 equivalence (ch
, my_char
)
58 equivalence (num
, my_num
)
59 equivalence (my_num
, his_num
, thy_num
)
60 equivalence (my_z
, thy_z
)
61 equivalence (my_mixed
, thy_mixed
)
63 ! Not permitted by the standard - OK with -std=gnu
64 equivalence (my_mixed
, my_num
) ! { dg-error "with mixed components in EQUIVALENCE" }
65 equivalence (my_z
, num
) ! { dg-error "Non-default type object or sequence" }
66 equivalence (my_char
, my_num
) ! { dg-error "in default CHARACTER EQUIVALENCE" }
67 equivalence (ch
, my_num
) ! { dg-error "in default CHARACTER EQUIVALENCE" }
68 equivalence (my_num
, ch
) ! { dg-error "in default NUMERIC EQUIVALENCE" }
69 equivalence (num
, my_char
) ! { dg-error "in default NUMERIC EQUIVALENCE" }
70 equivalence (my_char
, num
) ! { dg-error "in default CHARACTER EQUIVALENCE" }
71 equivalence (non_def
, ch
) ! { dg-error "Non-default type object or sequence" }
72 equivalence (my_z
, ch
) ! { dg-error "Non-default type object or sequence" }
73 equivalence (my_z
, num
) ! { dg-error "Non-default type object or sequence" }