Skip to content

Commit 60dced5

Browse files
authored
Merge pull request #80584 from swiftlang/gaborh/rvalue-ref-calling-conv-6.2
[6.2][cxx-interop] Fix calling rvalue ref of a trivial type
2 parents 3a4215d + 56e0ea6 commit 60dced5

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

lib/SIL/IR/SILFunctionType.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1543,6 +1543,9 @@ static bool isClangTypeMoreIndirectThanSubstType(TypeConverter &TC,
15431543
if (importer::isCxxConstReferenceType(clangTy))
15441544
return true;
15451545

1546+
if (clangTy->isRValueReferenceType())
1547+
return true;
1548+
15461549
return false;
15471550
}
15481551

test/Interop/Cxx/reference/reference.swift

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,4 +103,9 @@ ReferenceTestSuite.test("const reference to template") {
103103
expectEqual(53, ref.pointee)
104104
}
105105

106+
ReferenceTestSuite.test("rvalue reference of trivial type") {
107+
setStaticIntRvalueRef(consuming: 2)
108+
expectEqual(2, getStaticInt())
109+
}
110+
106111
runAllTests()

0 commit comments

Comments
 (0)