parent
db988f42a7
commit
663e665843
|
@ -1606,6 +1606,10 @@ Error type_allowed_in_extern(CodeGen *g, ZigType *type_entry, bool *result) {
|
|||
*result = false;
|
||||
return ErrorNone;
|
||||
}
|
||||
if (!type_is_nonnull_ptr(child_type)) {
|
||||
*result = false;
|
||||
return ErrorNone;
|
||||
}
|
||||
return type_allowed_in_extern(g, child_type, result);
|
||||
}
|
||||
case ZigTypeIdEnum:
|
||||
|
|
|
@ -15,6 +15,16 @@ pub fn addCases(cases: *tests.CompileErrorContext) void {
|
|||
"tmp.zig:5:9: error: duplicate switch value",
|
||||
);
|
||||
|
||||
cases.add(
|
||||
"invalid optional type in extern struct",
|
||||
\\const stroo = extern struct {
|
||||
\\ moo: ?[*c]u8,
|
||||
\\};
|
||||
\\export fn testf(fluff: *stroo) void {}
|
||||
,
|
||||
"tmp.zig:2:5: error: extern structs cannot contain fields of type '?[*c]u8'",
|
||||
);
|
||||
|
||||
cases.add(
|
||||
"attempt to negate a non-integer, non-float or non-vector type",
|
||||
\\fn foo() anyerror!u32 {
|
||||
|
|
Loading…
Reference in New Issue