Stage1: Add compile error for an empty switch on a integer
This commit is contained in:
committed by
Andrew Kelley
parent
e3404e3c78
commit
94299d16d1
@@ -2,6 +2,16 @@ const tests = @import("tests.zig");
|
||||
const builtin = @import("builtin");
|
||||
|
||||
pub fn addCases(cases: *tests.CompileErrorContext) void {
|
||||
cases.add(
|
||||
"empty switch on an integer",
|
||||
\\export fn entry() void {
|
||||
\\ var x: u32 = 0;
|
||||
\\ switch(x) {}
|
||||
\\}
|
||||
,
|
||||
"tmp.zig:3:5: error: switch must handle all possibilities",
|
||||
);
|
||||
|
||||
cases.add(
|
||||
"regression test #2980: base type u32 is not type checked properly when assigning a value within a struct",
|
||||
\\const Foo = struct {
|
||||
|
||||
Reference in New Issue
Block a user