mirror of
https://github.com/ziglang/zig.git
synced 2025-12-06 06:13:07 +00:00
backend=auto (now the default if backend is omitted) means to let the compiler pick whatever backend it wants as the default. This is important for platforms where we don't yet have a self-hosted backend, such as loongarch64. Also purge a bunch of redundant target=native.
34 lines
653 B
Zig
34 lines
653 B
Zig
comptime {
|
|
const a = "foo";
|
|
if (a != "foo") unreachable;
|
|
}
|
|
comptime {
|
|
const a = "foo";
|
|
if (a == "foo") {} else unreachable;
|
|
}
|
|
comptime {
|
|
const a = "foo";
|
|
if (a != ("foo")) {} // intentionally allow
|
|
if (a == ("foo")) {} // intentionally allow
|
|
}
|
|
comptime {
|
|
const a = "foo";
|
|
switch (a) {
|
|
"foo" => {},
|
|
else => unreachable,
|
|
}
|
|
}
|
|
comptime {
|
|
const a = "foo";
|
|
switch (a) {
|
|
("foo") => {}, // intentionally allow
|
|
else => {},
|
|
}
|
|
}
|
|
|
|
// error
|
|
//
|
|
// :3:11: error: cannot compare strings with !=
|
|
// :7:11: error: cannot compare strings with ==
|
|
// :17:9: error: cannot switch on strings
|