Debian Codegraph @

gcc/testsuite/gfortran.dg/dec_union_7.f90

raw
1 ! { dg-do compile }
2 ! { dg-options "-fdec-structure" }
3 !
4 ! Comprehensive compile tests for what unions CAN'T do.
5 !
6
7 ! Syntax errors
8 structure /s0/
9 union a b c ! { dg-error "Junk after UNION" }
10 union
11 map a b c ! { dg-error "Junk after MAP" }
12 integer x ! { dg-error "Unexpected" }
13 structure /s2/ ! { dg-error "Unexpected" }
14 map
15 map ! { dg-error "Unexpected" }
16 end map
17 end union
18 end structure
19
20 ! Initialization expressions
21 structure /s1/
22 union
23 map
24 integer(4) :: x = 1600 ! { dg-error "Conflicting initializers" }
25 integer(4) :: y = 1800
26 end map
27 map
28 integer(2) a, b, c, d
29 integer :: e = 0 ! { dg-error "Conflicting initializers" }
30 end map
31 map
32 real :: p = 1.3, q = 3.7 ! { dg-error "Conflicting initializers" }
33 end map
34 end union
35 end structure
36 record /s1/ r1
37
38 end