- if (!psi_decl_type_get_struct(type, data->structs) && !def) {
- data->error(data, type->token, PSI_WARNING,
- "Unknown struct '%s'", type->name);
+ if (!psi_decl_type_get_struct(type, data->structs)) {
+ if (psi_validate_scope_has_struct(scope, type->name)) {
+ type->real.strct = psi_validate_scope_get_struct(scope, type->name);
+ } else if (def && def->var->pointer_level) {
+ return true;
+ } else {
+ data->error(data, type->token, PSI_WARNING,
+ "Unknown struct '%s'", type->name->val);
+ return false;
+ }
+ }
+ if (!psi_decl_struct_validate(data, type->real.strct, scope)) {