| author | |
| committer | |
| log | 663e665843627cead40258a74ffddf4574fbb816 |
| tree | adb2f8bb7a31a7a0fd7903a7f71485f4056a0c86 |
| parent | db988f42a7ac1ce0ec65fde0e7ea94009b1d7238 |
| signature |
Fixes #32402 files changed, 14 insertions(+), 0 deletions(-)
src/analyze.cpp+4| ... | ... | @@ -1606,6 +1606,10 @@ Error type_allowed_in_extern(CodeGen *g, ZigType *type_entry, bool *result) { |
| 1606 | 1606 | *result = false; |
| 1607 | 1607 | return ErrorNone; |
| 1608 | 1608 | } |
| 1609 | if (!type_is_nonnull_ptr(child_type)) { | |
| 1610 | *result = false; | |
| 1611 | return ErrorNone; | |
| 1612 | } | |
| 1609 | 1613 | return type_allowed_in_extern(g, child_type, result); |
| 1610 | 1614 | } |
| 1611 | 1615 | case ZigTypeIdEnum: |
test/compile_errors.zig+10| ... | ... | @@ -15,6 +15,16 @@ pub fn addCases(cases: *tests.CompileErrorContext) void { |
| 15 | 15 | "tmp.zig:5:9: error: duplicate switch value", |
| 16 | 16 | ); |
| 17 | 17 | |
| 18 | cases.add( | |
| 19 | "invalid optional type in extern struct", | |
| 20 | \\const stroo = extern struct { | |
| 21 | \\ moo: ?[*c]u8, | |
| 22 | \\}; | |
| 23 | \\export fn testf(fluff: *stroo) void {} | |
| 24 | , | |
| 25 | "tmp.zig:2:5: error: extern structs cannot contain fields of type '?[*c]u8'", | |
| 26 | ); | |
| 27 | ||
| 18 | 28 | cases.add( |
| 19 | 29 | "attempt to negate a non-integer, non-float or non-vector type", |
| 20 | 30 | \\fn foo() anyerror!u32 { |