aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests/unions.sh
blob: b5887928c94a6c38c8dd5db6ed57301b443e8b1b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
cat <<'EOF' > expected
8
42
42
EOF

test_diff <<'EOF'
int printf();

union U {
    int i;
    long l;
};

int main() {
    union U u;
    printf("%zu\n", sizeof(u));
    u.l = 42;
    printf("%d\n", u.i);
    printf("%ld\n", u.l);
}
EOF