| 1 | extern fn next_id() u32; |
| 2 | |
| 3 | const Foo = struct { |
| 4 | bar: Bar, |
| 5 | |
| 6 | fn init() Foo { |
| 7 | return .{ .bar = .init() }; |
| 8 | } |
| 9 | }; |
| 10 | const Bar = struct { |
| 11 | qux: ?Qux, |
| 12 | id: u32, |
| 13 | |
| 14 | fn init() Bar { |
| 15 | return .{ |
| 16 | .qux = null, |
| 17 | .id = next_id(), |
| 18 | }; |
| 19 | } |
| 20 | }; |
| 21 | const Qux = struct { |
| 22 | handleThing: fn () void, |
| 23 | }; |
| 24 | |
| 25 | export fn entry() void { |
| 26 | const foo: Foo = .init(); |
| 27 | _ = foo; |
| 28 | } |
| 29 | |
| 30 | // error |
| 31 | // |
| 32 | // :17:26: error: comptime call of extern function |
| 33 | // :7:31: note: called at comptime from here |
| 34 | // :26:27: note: called at comptime from here |
| 35 | // :26:27: note: call to function with comptime-only return type 'tmp.Foo' is evaluated at comptime |
| 36 | // :6:15: note: return type declared here |
| 37 | // :4:10: note: struct requires comptime because of this field |
| 38 | // :11:10: note: struct requires comptime because of this field |
| 39 | // :22:18: note: struct requires comptime because of this field |
| 40 | // :22:18: note: use '*const fn () void' for a function pointer type |