blob: 95f6fa4122d3faedbc8e5446c7c47c040f55cbec (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
|
comptime {
const a = "foo";
if (a == "foo") unreachable;
}
comptime {
const a = "foo";
if (a == ("foo")) unreachable; // intentionally allow
}
comptime {
const a = "foo";
switch (a) {
"foo" => unreachable,
else => {},
}
}
comptime {
const a = "foo";
switch (a) {
("foo") => unreachable, // intentionally allow
else => {},
}
}
// error
// backend=stage2
// target=native
//
// :3:11: error: cannot compare strings with ==
// :12:9: error: cannot switch on strings
|