OutOfMemory
and segfault when using anytype
for argument in
#22363
Labels
bug
Observed behavior contradicts documented or intended behavior
Zig Version
0.14.0-dev.2577+271452d22
Steps to Reproduce and Observed Behavior
Whilst slimming the code down into a smaller reproducible example, I encountered another seemingly linked issue. These both appear to be emitted during compilation, though I'm not completely sure.
All of the examples below were tested with a plain
zig run main.zig
on x86-64 Linux.Example 1
This example exits with code 1 and prints an
OutOfMemory
error to the terminal.If you change the code to use concrete types instead of
anytype
s, then the issue is resolved.Example 2
This example segmentation faults. The only change here is that the
initGeneric
function returns a value that is incompatible with its return type.If you change the code to use concrete types instead of
anytype
s, then the issue is resolved and you instead get a correct type error related to the return ofinitGeneric
.Edit 1
After more searching through this issue tracker, this could be related to or duplicate of #21099 and/or #21850. If so, feel free to close this issue.
Edit 2
I tried out the above examples in Zig 0.13.0 and these were the results.
Example 1 prints the text below and then aborts (SIGABRT).
Example 2 segmentation faults as it does above.
Expected Behavior
The examples should work as their concretely typed alternatives do.
The text was updated successfully, but these errors were encountered: