diff options
| author | Andrew Kelley <andrew@ziglang.org> | 2021-08-06 19:40:55 -0700 |
|---|---|---|
| committer | Andrew Kelley <andrew@ziglang.org> | 2021-08-06 19:53:04 -0700 |
| commit | 7d0de54ad44832589379a4bcbba493db2087bebf (patch) | |
| tree | 5efb0a82c4ad399e25f603ba25cc6e36566ca845 /test/behavior/basic.zig | |
| parent | e974d4c4295c4fbdbc239caa2cf2d653f65662f1 (diff) | |
| download | zig-7d0de54ad44832589379a4bcbba493db2087bebf.tar.gz zig-7d0de54ad44832589379a4bcbba493db2087bebf.zip | |
stage2: fix return pointer result locations
* Introduce `ret_load` ZIR instruction which does return semantics
based on a corresponding `ret_ptr` instruction. If the return type of
the function has storage for the return type, it simply returns.
However if the return type of the function is by-value, it loads the
return value from the `ret_ptr` allocation and returns that.
* AstGen: improve `finishThenElseBlock` to not emit break instructions
after a return instruction in the same block.
* Sema: `ret_ptr` instruction works correctly in comptime contexts.
Same with `alloc_mut`.
The test case with a recursive inline function having an implicitly
comptime return value now has a runtime return value because of the fact
that it calls a function in a non-comptime context.
Diffstat (limited to 'test/behavior/basic.zig')
0 files changed, 0 insertions, 0 deletions
