zig/test/behavior/bugs/12928.zig
2023-09-23 12:36:56 -07:00

31 lines
601 B
Zig

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);
}