zig/test/cases/compile_errors/invalid_identifiers.zig
Veikka Tuominen a463dc7d6c AstGen: disable null bytes and empty stings in some places
Namely:
 * test names
 * identifiers
 * library names
 * import strings
2022-07-26 12:14:59 +03:00

33 lines
812 B
Zig

extern "" var a: u32;
extern "" fn b() void;
extern "\x00" var c: u32;
extern "\x00" fn d() void;
test "" {}
test "\x00" {}
const e = @import("");
const f = @import("\x00");
comptime {
const @"" = undefined;
}
comptime {
const @"\x00" = undefined;
}
// error
// backend=stage2
// target=native
//
// :1:8: error: library name cannot be empty
// :2:8: error: library name cannot be empty
// :4:8: error: library name cannot contain null bytes
// :5:8: error: library name cannot contain null bytes
// :7:6: error: empty test name must be omitted
// :8:6: error: test name cannot contain null bytes
// :10:19: error: import path cannot be empty
// :11:19: error: import path cannot contain null bytes
// :14:11: error: identifier cannot be empty
// :17:11: error: identifier cannot contain null bytes