diff options
| author | Andrew Kelley <superjoe30@gmail.com> | 2017-03-14 21:38:27 -0400 |
|---|---|---|
| committer | Andrew Kelley <superjoe30@gmail.com> | 2017-03-14 21:38:27 -0400 |
| commit | a76558db26ea175504830ae4aa840a1aa82b16d0 (patch) | |
| tree | 77557c27d4ab823654a5403ce8d69ea6d0e49408 /test | |
| parent | 7bc0145b802002c38a409dd9fe0b297c8af82391 (diff) | |
| download | zig-a76558db26ea175504830ae4aa840a1aa82b16d0.tar.gz zig-a76558db26ea175504830ae4aa840a1aa82b16d0.zip | |
fix behavior with reinterpreting constant memory
Diffstat (limited to 'test')
| -rw-r--r-- | test/cases/cast.zig | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/test/cases/cast.zig b/test/cases/cast.zig index 3ab5834d4f..a7bef9ded5 100644 --- a/test/cases/cast.zig +++ b/test/cases/cast.zig @@ -15,3 +15,13 @@ fn numLitIntToPtrCast() { const vga_mem = (&u16)(0xB8000); assert(usize(vga_mem) == 0xB8000); } + +fn pointerReinterpretConstFloatToInt() { + @setFnTest(this); + + const float: f64 = 5.99999999999994648725e-01; + const float_ptr = &float; + const int_ptr = (&i32)(float_ptr); + const int_val = *int_ptr; + assert(int_val == 858993411); +} |
