Files
zig/test/cases/compile_errors/function_parameter_is_opaque.zig
Jacob Young a257e33fff Type: remove arbitrary restrictions on param and return types
Opaque and `noreturn` makes sense since they don't represent real
values, but `null` and `undefined` are perfectly normal
comptime-only values.

Closes #16088
2023-06-20 21:51:01 -07:00

22 lines
468 B
Zig

const FooType = opaque {};
export fn entry1() void {
const someFuncPtr: fn (FooType) void = undefined;
_ = someFuncPtr;
}
fn foo(p: FooType) void {
_ = p;
}
export fn entry3() void {
_ = foo;
}
// error
// backend=stage2
// target=native
//
// :3:28: error: parameter of opaque type 'tmp.FooType' not allowed
// :1:17: note: opaque declared here
// :7:8: error: parameter of opaque type 'tmp.FooType' not allowed
// :1:17: note: opaque declared here