From fe8d65556dc49bb0da7ee621597c3b24f0e879f6 Mon Sep 17 00:00:00 2001 From: Andrew Kelley Date: Sun, 8 Dec 2019 12:13:34 -0500 Subject: add syntax for comptime struct fields --- test/compile_errors.zig | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'test/compile_errors.zig') 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"); -- cgit v1.2.3