diff options
| author | Andrew Kelley <superjoe30@gmail.com> | 2017-04-27 23:40:43 -0400 |
|---|---|---|
| committer | Andrew Kelley <superjoe30@gmail.com> | 2017-04-27 23:40:43 -0400 |
| commit | 458afb0ef9634b6a0480bcb6e07a92cd9a330d84 (patch) | |
| tree | 60788ee3dd56b66c81da0b1ef77ca09f46b5045a /test/compile_errors.zig | |
| parent | 2e512a0e6e81532b62ddb7fdafdcd28926690eaa (diff) | |
| download | zig-458afb0ef9634b6a0480bcb6e07a92cd9a330d84.tar.gz zig-458afb0ef9634b6a0480bcb6e07a92cd9a330d84.zip | |
phi instruction retains stack ptr hint
Diffstat (limited to 'test/compile_errors.zig')
| -rw-r--r-- | test/compile_errors.zig | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/test/compile_errors.zig b/test/compile_errors.zig index 9f0b9de232..b9ab36c1af 100644 --- a/test/compile_errors.zig +++ b/test/compile_errors.zig @@ -1611,11 +1611,21 @@ pub fn addCases(cases: &tests.CompileErrorContext) { ".tmp_source.zig:3:5: error: cannot set section of external function 'foo'", ".tmp_source.zig:1:8: note: declared here"); - cases.add("returning address of local variable", + cases.add("returning address of local variable - simple", \\export fn foo() -> &i32 { \\ var a: i32 = undefined; \\ return &a; \\} , ".tmp_source.zig:3:13: error: function returns address of local variable"); + + cases.add("returning address of local variable - phi", + \\export fn foo(c: bool) -> &i32 { + \\ var a: i32 = undefined; + \\ var b: i32 = undefined; + \\ return if (c) &a else &b; + \\} + , + ".tmp_source.zig:4:12: error: function returns address of local variable"); + } |
