File tree Expand file tree Collapse file tree 3 files changed +15
-7
lines changed
test/Interop/Cxx/templates Expand file tree Collapse file tree 3 files changed +15
-7
lines changed Original file line number Diff line number Diff line change @@ -2698,19 +2698,17 @@ class CXXMethodConventions : public CFunctionTypeConventions {
2698
2698
TheDecl(decl), isMutating(isMutating) {}
2699
2699
ParameterConvention
2700
2700
getIndirectSelfParameter (const AbstractionPattern &type) const override {
2701
- llvm_unreachable (
2702
- " cxx functions do not have a Swift self parameter; "
2703
- " foreign self parameter is handled in getIndirectParameter " ) ;
2701
+ if (isMutating)
2702
+ return ParameterConvention::Indirect_Inout;
2703
+ return ParameterConvention::Indirect_In_Guaranteed ;
2704
2704
}
2705
2705
2706
2706
ParameterConvention
2707
2707
getIndirectParameter (unsigned int index, const AbstractionPattern &type,
2708
2708
const TypeLowering &substTL) const override {
2709
2709
// `self` is the last parameter.
2710
2710
if (index == TheDecl->getNumParams ()) {
2711
- if (isMutating)
2712
- return ParameterConvention::Indirect_Inout;
2713
- return ParameterConvention::Indirect_In_Guaranteed;
2711
+ return getIndirectSelfParameter (type);
2714
2712
}
2715
2713
return super::getIndirectParameter (index, type, substTL);
2716
2714
}
Original file line number Diff line number Diff line change @@ -28,6 +28,10 @@ template <class T> struct TemplateClassWithMemberTemplates {
28
28
29
29
template <class U > void setValue (U val) { value = val; }
30
30
31
+ template <class U > TemplateClassWithMemberTemplates<U> toOtherSpec (const U& u) const {
32
+ return {u};
33
+ }
34
+
31
35
TemplateClassWithMemberTemplates (T val) : value(val) {}
32
36
};
33
37
Original file line number Diff line number Diff line change 4
4
//
5
5
// We can't yet call member functions correctly on Windows (SR-13129).
6
6
// XFAIL: OS=windows-msvc
7
- // REQUIRES: fixing-after-30630
8
7
9
8
import MemberTemplates
10
9
import StdlibUnittest
@@ -23,4 +22,11 @@ TemplatesTestSuite.test("Templated Add") {
23
22
expectEqual ( h. addMixedTypeParams ( 2 , 1 ) , 3 )
24
23
}
25
24
25
+ TemplatesTestSuite . test ( " Returns other specialization " ) {
26
+ let t = TemplateClassWithMemberTemplates < CInt > ( 42 )
27
+ var _5 = 5
28
+ let o = t. toOtherSpec ( & _5)
29
+ // TODO: why is "o" Void here? rdar://88443730
30
+ }
31
+
26
32
runAllTests ( )
You can’t perform that action at this time.
0 commit comments