diff options
| author | Veikka Tuominen <git@vexu.eu> | 2022-10-08 15:29:05 +0300 |
|---|---|---|
| committer | Veikka Tuominen <git@vexu.eu> | 2022-10-08 16:58:54 +0300 |
| commit | 3ccd4907fbcd04ecddffb618a4b14581fd080279 (patch) | |
| tree | 7db5554b1f8b2dcb5cef2fd4277d496d35ca385b /test/cases/compile_errors | |
| parent | b5c0a797a7f816e502129ad42d5bf19ff84b45e0 (diff) | |
| download | zig-3ccd4907fbcd04ecddffb618a4b14581fd080279.tar.gz zig-3ccd4907fbcd04ecddffb618a4b14581fd080279.zip | |
Sema: add error for capturing a runtime value outside of function scope
Closes #13104
Diffstat (limited to 'test/cases/compile_errors')
| -rw-r--r-- | test/cases/compile_errors/accessing_runtime_paramter_outside_function_scope.zig | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/test/cases/compile_errors/accessing_runtime_paramter_outside_function_scope.zig b/test/cases/compile_errors/accessing_runtime_paramter_outside_function_scope.zig new file mode 100644 index 0000000000..583b7128c7 --- /dev/null +++ b/test/cases/compile_errors/accessing_runtime_paramter_outside_function_scope.zig @@ -0,0 +1,12 @@ +export fn entry(y: u8) void { + const Thing = struct { + y: u8 = y, + }; + _ = @sizeOf(Thing); +} + +// error +// backend=stage2 +// target=native +// +// :3:17: error: 'y' not accessible outside function scope |
