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
@@ -35,6 +35,26 @@ fn F() {
//@dump-sem-ir-end
}
// ============================================================================
// Undeduced return type
// ============================================================================
// --- fail_return_undeduced_auto.carbon
library "[[@TEST_NAME]]";
import Cpp inline '''
auto UndeducedReturn();
''';
fn Call() {
// CHECK:STDERR: fail_return_undeduced_auto.carbon:[[@LINE+4]]:3: error: semantics TODO: `Unsupported: return type: auto` [SemanticsTodo]
// CHECK:STDERR: Cpp.UndeducedReturn();
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~
// CHECK:STDERR:
Cpp.UndeducedReturn();
}
// CHECK:STDOUT: --- import_multiple.carbon
// CHECK:STDOUT:
// CHECK:STDOUT: constants {