aboutsummaryrefslogtreecommitdiff
path: root/test/compile_errors.zig
diff options
context:
space:
mode:
Diffstat (limited to 'test/compile_errors.zig')
-rw-r--r--test/compile_errors.zig11
1 files changed, 10 insertions, 1 deletions
diff --git a/test/compile_errors.zig b/test/compile_errors.zig
index 13e666f49e..3cdf8723ac 100644
--- a/test/compile_errors.zig
+++ b/test/compile_errors.zig
@@ -2,6 +2,15 @@ const tests = @import("tests.zig");
const builtin = @import("builtin");
pub fn addCases(cases: *tests.CompileErrorContext) void {
+ cases.add("comptime struct field, no init value",
+ \\const Foo = struct {
+ \\ comptime b: i32,
+ \\};
+ \\export fn entry() void {
+ \\ var f: Foo = undefined;
+ \\}
+ , "tmp.zig:2:5: error: comptime struct field missing initialization value");
+
cases.add(
"bad usage of @call",
\\export fn entry1() void {
@@ -32,7 +41,7 @@ pub fn addCases(cases: *tests.CompileErrorContext) void {
"tmp.zig:15:43: error: unable to evaluate constant expression",
);
- cases.add(
+ cases.add("exported async function",
\\export async fn foo() void {}
, "tmp.zig:1:1: error: exported function cannot be async");