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