Zig Version
0.13.0
Steps to Reproduce and Observed Behavior
(also fails using whatever version zig trunk on godbolt is using, but I wasnt sure exactly which that was so I put the version I currently have installed where it also fails)
Compile this code
const GenericFn = fn(comptime anytype)void;
fn foo(comptime _: i32) void {}
const f: GenericFn = foo;
pub fn main() void {
_ = f(0);
}
https://godbolt.org/z/haEjaGqf7
Returns either "error code 5" or "SIGSEV" depending on setup
Expected Behavior
Im not sure what specifically I expect it to do, but I dont expect it to segfault
I suspect it should be a compile error (given it is for the non-comptime case) and that makes the most sense to me. But Im not 100% sure the intended behaviour isnt that this works, so I thought I'd report here instead of the "error message" section.
I'm pretty sure its const f: GenericFn = foo; thats segfaulting since _ = @TypeOf(f); also causes a segfault and that doesnt call it. (removing both doesnt segfault but I assume thats because its not instantiated)
Zig Version
0.13.0
Steps to Reproduce and Observed Behavior
(also fails using whatever version zig trunk on godbolt is using, but I wasnt sure exactly which that was so I put the version I currently have installed where it also fails)
Compile this code
https://godbolt.org/z/haEjaGqf7
Returns either "error code 5" or "SIGSEV" depending on setup
Expected Behavior
Im not sure what specifically I expect it to do, but I dont expect it to segfault
I suspect it should be a compile error (given it is for the non-comptime case) and that makes the most sense to me. But Im not 100% sure the intended behaviour isnt that this works, so I thought I'd report here instead of the "error message" section.
I'm pretty sure its
const f: GenericFn = foo;thats segfaulting since_ = @TypeOf(f);also causes a segfault and that doesnt call it. (removing both doesnt segfault but I assume thats because its not instantiated)