aboutsummaryrefslogtreecommitdiff
path: root/test/compile_errors.zig
diff options
context:
space:
mode:
Diffstat (limited to 'test/compile_errors.zig')
-rw-r--r--test/compile_errors.zig12
1 files changed, 12 insertions, 0 deletions
diff --git a/test/compile_errors.zig b/test/compile_errors.zig
index f89dea1921..cbca4bb7e3 100644
--- a/test/compile_errors.zig
+++ b/test/compile_errors.zig
@@ -2,6 +2,18 @@ const tests = @import("tests.zig");
pub fn addCases(cases: *tests.CompileErrorContext) void {
cases.add(
+ "load too many bytes from comptime reinterpreted pointer",
+ \\export fn entry() void {
+ \\ const float: f32 = 5.99999999999994648725e-01;
+ \\ const float_ptr = &float;
+ \\ const int_ptr = @ptrCast(*const i64, float_ptr);
+ \\ const int_val = int_ptr.*;
+ \\}
+ ,
+ ".tmp_source.zig:5:28: error: attempt to read 8 bytes from pointer to f32 which is 4 bytes",
+ );
+
+ cases.add(
"invalid type used in array type",
\\const Item = struct {
\\ field: SomeNonexistentType,