diff options
| author | Veikka Tuominen <git@vexu.eu> | 2023-05-09 15:30:14 +0300 |
|---|---|---|
| committer | Veikka Tuominen <git@vexu.eu> | 2023-05-11 12:23:57 +0300 |
| commit | 0a7f8c2e013f24aa6c94093400fe6377ab74b4e1 (patch) | |
| tree | e8e264154db69d9e3b3edc8908d871a74a2f664e /test/behavior/basic.zig | |
| parent | 0ad692e76c2f09bb8dbac38208579cd76fcc5a07 (diff) | |
| download | zig-0a7f8c2e013f24aa6c94093400fe6377ab74b4e1.tar.gz zig-0a7f8c2e013f24aa6c94093400fe6377ab74b4e1.zip | |
Sema: return const pointers from ref inits
Closes #12189
Diffstat (limited to 'test/behavior/basic.zig')
| -rw-r--r-- | test/behavior/basic.zig | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/test/behavior/basic.zig b/test/behavior/basic.zig index 073be26288..5b8ca80198 100644 --- a/test/behavior/basic.zig +++ b/test/behavior/basic.zig @@ -1145,3 +1145,10 @@ test "arrays and vectors with big integers" { try expect(b[0] == comptime std.math.maxInt(Int)); } } + +test "pointer to struct literal with runtime field is constant" { + const S = struct { data: usize }; + var runtime_zero: usize = 0; + const ptr = &S{ .data = runtime_zero }; + try expect(@typeInfo(@TypeOf(ptr)).Pointer.is_const); +} |
