Skip to content

Commit 20222bb

Browse files
committed
[cxx-interop] Bail if trying to convert call result to void.
Don't try to coerce the result of a call to void. If the "expected" result type is void, just bail.
1 parent 4cb337a commit 20222bb

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

lib/IRGen/GenCall.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1924,6 +1924,9 @@ class SyncCallEmission final : public CallEmission {
19241924
// This can happen when calling C functions, or class method dispatch thunks
19251925
// for methods that have covariant ABI-compatible overrides.
19261926
auto expectedNativeResultType = nativeSchema.getExpandedType(IGF.IGM);
1927+
// If the expected result type is void, bail.
1928+
if (expectedNativeResultType->isVoidTy())
1929+
return;
19271930
if (result->getType() != expectedNativeResultType) {
19281931
result =
19291932
IGF.coerceValue(result, expectedNativeResultType, IGF.IGM.DataLayout);

0 commit comments

Comments
 (0)