| ... | ... | @@ -349,7 +349,15 @@ static TypeTableEntry *resolve_type_with_table(Context *c, const Type *ty, const |
| 349 | 349 | return c->codegen->builtin_types.entry_usize; |
| 350 | 350 | } else { |
| 351 | 351 | auto entry = type_table->maybe_get(type_name); |
| 352 | | return entry ? entry->value : c->codegen->builtin_types.entry_invalid; |
| 352 | if (entry) { |
| 353 | if (get_underlying_type(entry->value)->id == TypeTableEntryIdInvalid) { |
| 354 | return c->codegen->builtin_types.entry_invalid; |
| 355 | } else { |
| 356 | return entry->value; |
| 357 | } |
| 358 | } else { |
| 359 | return c->codegen->builtin_types.entry_invalid; |
| 360 | } |
| 353 | 361 | } |
| 354 | 362 | } |
| 355 | 363 | case Type::Elaborated: |
| ... | ... | @@ -405,7 +413,7 @@ static TypeTableEntry *resolve_type_with_table(Context *c, const Type *ty, const |
| 405 | 413 | fn_type_id.return_type = c->codegen->builtin_types.entry_unreachable; |
| 406 | 414 | } else { |
| 407 | 415 | fn_type_id.return_type = resolve_qual_type(c, fn_proto_ty->getReturnType(), decl); |
| 408 | | if (fn_type_id.return_type->id == TypeTableEntryIdInvalid) { |
| 416 | if (get_underlying_type(fn_type_id.return_type)->id == TypeTableEntryIdInvalid) { |
| 409 | 417 | return c->codegen->builtin_types.entry_invalid; |
| 410 | 418 | } |
| 411 | 419 | } |
| ... | ... | @@ -415,7 +423,7 @@ static TypeTableEntry *resolve_type_with_table(Context *c, const Type *ty, const |
| 415 | 423 | QualType qt = fn_proto_ty->getParamType(i); |
| 416 | 424 | TypeTableEntry *param_type = resolve_qual_type(c, qt, decl); |
| 417 | 425 | |
| 418 | | if (param_type->id == TypeTableEntryIdInvalid) { |
| 426 | if (get_underlying_type(param_type)->id == TypeTableEntryIdInvalid) { |
| 419 | 427 | return c->codegen->builtin_types.entry_invalid; |
| 420 | 428 | } |
| 421 | 429 | |