aboutsummaryrefslogtreecommitdiff
path: root/test/behavior/bugs/12928.zig
blob: 1d8afdd7c90e4dfefc1471dc979d7502fbba273a (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
const std = @import("std");
const builtin = @import("builtin");
const expect = std.testing.expect;

const A = extern struct {
    value: *volatile B,
};
const B = extern struct {
    a: u32,
    b: i32,
};

test {
    var a: *A = undefined;
    try expect(@TypeOf(&a.value.a) == *volatile u32);
    try expect(@TypeOf(&a.value.b) == *volatile i32);
}

const C = extern struct {
    value: *volatile D,
};
const D = extern union {
    a: u32,
    b: i32,
};
test {
    var c: *C = undefined;
    try expect(@TypeOf(&c.value.a) == *volatile u32);
    try expect(@TypeOf(&c.value.b) == *volatile i32);
}