zig
zig copied to clipboard
Compiler crash with extern function returning opaque
code:
const opq = opaque {};
extern fn fnname() opq;
test {
_ = &fnname;
}
results:
$ zig version
0.13.0
$ zig test opaque.zig
opaque.zig:2:20: error: opaque return type 'opaque.opq' not allowed
extern fn fnname() opq;
^~~
opaque.zig:1:13: note: opaque declared here
const opq = opaque {};
^~~~~~~~~
$ zig14 version
0.14.0-dev.1080+da8fbcc2a
$ zig14 test opaque.zig
Trace/breakpoint trap (core dumped)
Both compilers are x86_64 linux downloaded from the website
It does cause a compile error but the function is still sent to the backend.
$ zig-dev test a.zig -fno-emit-bin
a.zig:4:20: error: opaque return type 'a.opq' not allowed
extern fn fnname() opq;
^~~
a.zig:3:13: note: opaque declared here
const opq = opaque {};
^~~~~~~~~