C++ Interop: Don't crash when trying to call a C++ function with undeduced return type (#6363)

This crashed on trying to build a C++ thunk because the error wasn't
propagated.

Part of #5436.
This commit is contained in:
Boaz Brickner
2025-11-13 20:53:03 +00:00
committed by GitHub
parent 5ae5170421
commit 2ad26487b6
2 changed files with 23 additions and 0 deletions
+3
View File
@@ -1546,6 +1546,9 @@ static auto GetReturnPattern(Context& context, SemIR::LocId loc_id,
// void.
return SemIR::InstId::None;
}
if (type_inst_id == SemIR::ErrorInst::TypeInstId) {
return SemIR::ErrorInst::InstId;
}
auto pattern_type_id = GetPatternType(context, type_id);
clang::SourceLocation return_type_loc =
clang_decl->getReturnTypeSourceRange().getBegin();