stage1: fix crash on slice byte reinterpretation
This commit is contained in:
@@ -7495,4 +7495,13 @@ pub fn addCases(cases: *tests.CompileErrorContext) void {
|
||||
":22:12: error: cannot compare types '?[3]i32' and '[3]i32'",
|
||||
":22:12: note: operator not supported for type '[3]i32'",
|
||||
});
|
||||
|
||||
cases.add("slice cannot have its bytes reinterpreted",
|
||||
\\export fn foo() void {
|
||||
\\ const bytes = [1]u8{ 0xfa } ** 16;
|
||||
\\ var value = @ptrCast(*const []const u8, &bytes).*;
|
||||
\\}
|
||||
, &[_][]const u8{
|
||||
":3:52: error: slice '[]const u8' cannot have its bytes reinterpreted",
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user