diff options
| author | Veikka Tuominen <git@vexu.eu> | 2022-07-25 13:48:21 +0300 |
|---|---|---|
| committer | Veikka Tuominen <git@vexu.eu> | 2022-07-25 22:04:08 +0300 |
| commit | 2f34d06d01189ae6349e9c6341ba85ec50b92bb0 (patch) | |
| tree | ecf6ce792234a32bca10b0a1e145595f401b270d /test/compile_errors.zig | |
| parent | 370793a36b3de34ead8456553a2aa2c56f0d3de8 (diff) | |
| download | zig-2f34d06d01189ae6349e9c6341ba85ec50b92bb0.tar.gz zig-2f34d06d01189ae6349e9c6341ba85ec50b92bb0.zip | |
Sema: `analyzeInlineCallArg` needs a block for the arg and the param
Diffstat (limited to 'test/compile_errors.zig')
| -rw-r--r-- | test/compile_errors.zig | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/test/compile_errors.zig b/test/compile_errors.zig index fe6145cc12..180cf74bcb 100644 --- a/test/compile_errors.zig +++ b/test/compile_errors.zig @@ -183,6 +183,30 @@ pub fn addCases(ctx: *TestContext) !void { }); } + { + const case = ctx.obj("argument causes error ", .{}); + case.backend = .stage2; + + case.addSourceFile("b.zig", + \\pub const ElfDynLib = struct { + \\ pub fn lookup(self: *ElfDynLib, comptime T: type) ?T { + \\ _ = self; + \\ return undefined; + \\ } + \\}; + ); + + case.addError( + \\pub export fn entry() void { + \\ var lib: @import("b.zig").ElfDynLib = undefined; + \\ _ = lib.lookup(fn () void); + \\} + , &[_][]const u8{ + ":3:12: error: unable to resolve comptime value", + ":3:12: note: argument to function being called at comptime must be comptime known", + }); + } + // TODO test this in stage2, but we won't even try in stage1 //ctx.objErrStage1("inline fn calls itself indirectly", // \\export fn foo() void { |
