diff options
| author | Andrew Kelley <andrew@ziglang.org> | 2023-04-29 11:13:51 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-04-29 11:13:51 -0700 |
| commit | c83ab7cc6a7d779eecd51eb10c46d1242aaf1d9d (patch) | |
| tree | 0a079e25b35539cfa169cb529eec278c15003d4c /test/cases/compile_errors | |
| parent | 7baf0de807afc8c2c56cc1278e624e9103c30cfb (diff) | |
| parent | bd8b5c25ece2fa158196381004db6e655226576c (diff) | |
| download | zig-c83ab7cc6a7d779eecd51eb10c46d1242aaf1d9d.tar.gz zig-c83ab7cc6a7d779eecd51eb10c46d1242aaf1d9d.zip | |
Merge pull request #15503 from r00ster91/noinline
Sema: emit error for always_inline call of noinline function
Diffstat (limited to 'test/cases/compile_errors')
| -rw-r--r-- | test/cases/compile_errors/bad_usage_of_call.zig | 20 |
1 files changed, 16 insertions, 4 deletions
diff --git a/test/cases/compile_errors/bad_usage_of_call.zig b/test/cases/compile_errors/bad_usage_of_call.zig index c0b632bef6..3669cda3bf 100644 --- a/test/cases/compile_errors/bad_usage_of_call.zig +++ b/test/cases/compile_errors/bad_usage_of_call.zig @@ -14,14 +14,25 @@ export fn entry5(c: bool) void { var baz = if (c) &baz1 else &baz2; @call(.compile_time, baz, .{}); } +export fn entry6() void { + _ = @call(.always_inline, dummy, .{}); +} +export fn entry7() void { + _ = @call(.always_inline, dummy2, .{}); +} pub export fn entry() void { var call_me: *const fn () void = undefined; @call(.always_inline, call_me, .{}); } + fn foo() void {} -fn bar() callconv(.Inline) void {} +inline fn bar() void {} fn baz1() void {} fn baz2() void {} +noinline fn dummy() u32 { + return 0; +} +noinline fn dummy2() void {} // error // backend=stage2 @@ -30,7 +41,8 @@ fn baz2() void {} // :2:23: error: expected a tuple, found 'void' // :5:21: error: unable to perform 'never_inline' call at compile-time // :8:21: error: unable to perform 'never_tail' call at compile-time -// :11:5: error: no-inline call of inline function +// :11:5: error: 'never_inline' call of inline function // :15:26: error: modifier 'compile_time' requires a comptime-known function -// :19:27: error: modifier 'always_inline' requires a comptime-known function - +// :18:9: error: 'always_inline' call of noinline function +// :21:9: error: 'always_inline' call of noinline function +// :25:27: error: modifier 'always_inline' requires a comptime-known function |
