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 {
26982698 TheDecl(decl), isMutating(isMutating) {}
26992699 ParameterConvention
27002700 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 ;
27042704 }
27052705
27062706 ParameterConvention
27072707 getIndirectParameter (unsigned int index, const AbstractionPattern &type,
27082708 const TypeLowering &substTL) const override {
27092709 // `self` is the last parameter.
27102710 if (index == TheDecl->getNumParams ()) {
2711- if (isMutating)
2712- return ParameterConvention::Indirect_Inout;
2713- return ParameterConvention::Indirect_In_Guaranteed;
2711+ return getIndirectSelfParameter (type);
27142712 }
27152713 return super::getIndirectParameter (index, type, substTL);
27162714 }
Original file line number Diff line number Diff line change @@ -28,6 +28,10 @@ template <class T> struct TemplateClassWithMemberTemplates {
2828
2929 template <class U > void setValue (U val) { value = val; }
3030
31+ template <class U > TemplateClassWithMemberTemplates<U> toOtherSpec (const U& u) const {
32+ return {u};
33+ }
34+
3135 TemplateClassWithMemberTemplates (T val) : value(val) {}
3236};
3337
Original file line number Diff line number Diff line change 44//
55// We can't yet call member functions correctly on Windows (SR-13129).
66// XFAIL: OS=windows-msvc
7- // REQUIRES: fixing-after-30630
87
98import MemberTemplates
109import StdlibUnittest
@@ -23,4 +22,11 @@ TemplatesTestSuite.test("Templated Add") {
2322 expectEqual ( h. addMixedTypeParams ( 2 , 1 ) , 3 )
2423}
2524
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+
2632runAllTests ( )
You can’t perform that action at this time.
0 commit comments