Disallow anonymous structs with procedures as default values

This commit is contained in:
Ginger Bill
2017-10-01 21:22:39 +01:00
parent afb5538e83
commit ee904060c5
2 changed files with 63 additions and 22 deletions

View File

@@ -3301,6 +3301,11 @@ bool check_type_internal(Checker *c, AstNode *e, Type **type, Type *named_type)
check_struct_type(c, *type, e, nullptr, named_type);
check_close_scope(c);
(*type)->Struct.node = e;
if (named_type == nullptr && (*type)->Struct.has_proc_default_values) {
error(e, "Anonymous structs cannot have procedures as default values");
}
return true;
case_end;