aboutsummaryrefslogtreecommitdiff
path: root/compiler/tests/verifier/type_compatibility_union.bad
blob: acedf4e9c136f0f215e1805e31ad2115cd8708b0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32

typedef U1 = union (int i, bool b);
typedef U2 = union (int i, bool b);

() test() {
    var U1 a1;
    var U2 a2;
    var (int i, bool b) b;
    var (int i, bool b, uint u) c;
    var (int, bool) d;
    var (int, int) e;
    var (int p, bool q) f;
    
    /* ERRORS: types referenced by name are different => error */
    a1 = a2;
    a2 = a1;
    
    /* ERRORS: different lengths of structs */
    b = c;
    c = b;
    d = c;
    c = d;
    
    /* ERRORS: different types */
    d = e;
    e = d;
    
    /* ERRORS: different member names */
    f = b;
    b = f;
}