mirror of
https://github.com/ziglang/zig.git
synced 2025-12-14 02:03:08 +00:00
These operations are allowed because the string literals are just pointers but they produce unexpected results. These errors prevent beginners from shooting themselves in the foot while still allowing advanced users to circumvent them if they desire to do so. Closes #8290
14 lines
253 B
Zig
14 lines
253 B
Zig
pub export fn entry() void {
|
|
var a: [:0]const u8 = "foo";
|
|
switch (a) {
|
|
("--version"), ("version") => unreachable,
|
|
else => {},
|
|
}
|
|
}
|
|
|
|
// error
|
|
// backend=stage2
|
|
// target=native
|
|
//
|
|
// :3:13: error: switch on type '[:0]const u8'
|