File tree Expand file tree Collapse file tree 1 file changed +15
-3
lines changed Expand file tree Collapse file tree 1 file changed +15
-3
lines changed Original file line number Diff line number Diff line change @@ -2339,9 +2339,6 @@ namespace {
2339
2339
2340
2340
// Make sure the synthesized decl can be found by lookupDirect.
2341
2341
result->addMemberToLookupTable (opFuncDecl);
2342
-
2343
- addEntryToLookupTable (*Impl.findLookupTable (decl), cxxMethod,
2344
- Impl.getNameImporter ());
2345
2342
}
2346
2343
}
2347
2344
methods.push_back (MD);
@@ -3005,6 +3002,21 @@ namespace {
3005
3002
if (isSpecializationDepthGreaterThan (def, 8 ))
3006
3003
return nullptr ;
3007
3004
3005
+ // For class template instantiations, we need to add their member
3006
+ // operators to the lookup table to make them discoverable with
3007
+ // unqualified lookup. This makes it possible to implement a Swift
3008
+ // protocol requirement with an instantiation of a C++ member operator.
3009
+ // This cannot be done when building the lookup table,
3010
+ // because templates are instantiated lazily.
3011
+ for (auto member : def->decls ()) {
3012
+ if (auto method = dyn_cast<clang::CXXMethodDecl>(member)) {
3013
+ if (method->isOverloadedOperator ()) {
3014
+ addEntryToLookupTable (*Impl.findLookupTable (decl), method,
3015
+ Impl.getNameImporter ());
3016
+ }
3017
+ }
3018
+ }
3019
+
3008
3020
return VisitCXXRecordDecl (def);
3009
3021
}
3010
3022
You can’t perform that action at this time.
0 commit comments