| ... | @@ -349,7 +349,15 @@ static TypeTableEntry *resolve_type_with_table(Context *c, const Type *ty, const | ... | @@ -349,7 +349,15 @@ static TypeTableEntry *resolve_type_with_table(Context *c, const Type *ty, const |
| 349 | return c->codegen->builtin_types.entry_usize; | 349 | return c->codegen->builtin_types.entry_usize; |
| 350 | } else { | 350 | } else { |
| 351 | auto entry = type_table->maybe_get(type_name); | 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 | case Type::Elaborated: | 363 | case Type::Elaborated: |
| ... | @@ -405,7 +413,7 @@ static TypeTableEntry *resolve_type_with_table(Context *c, const Type *ty, const | ... | @@ -405,7 +413,7 @@ static TypeTableEntry *resolve_type_with_table(Context *c, const Type *ty, const |
| 405 | fn_type_id.return_type = c->codegen->builtin_types.entry_unreachable; | 413 | fn_type_id.return_type = c->codegen->builtin_types.entry_unreachable; |
| 406 | } else { | 414 | } else { |
| 407 | fn_type_id.return_type = resolve_qual_type(c, fn_proto_ty->getReturnType(), decl); | 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 | return c->codegen->builtin_types.entry_invalid; | 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,7 +423,7 @@ static TypeTableEntry *resolve_type_with_table(Context *c, const Type *ty, const |
| 415 | QualType qt = fn_proto_ty->getParamType(i); | 423 | QualType qt = fn_proto_ty->getParamType(i); |
| 416 | TypeTableEntry *param_type = resolve_qual_type(c, qt, decl); | 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 | return c->codegen->builtin_types.entry_invalid; | 427 | return c->codegen->builtin_types.entry_invalid; |
| 420 | } | 428 | } |
| 421 | | 429 | |