@@ -1300,8 +1300,7 @@ bool Sema::CppLookupName(LookupResult &R, Scope *S) {
1300
1300
for (Scope *PreS = S; PreS; PreS = PreS->getParent ())
1301
1301
if (DeclContext *DC = PreS->getEntity ()) {
1302
1302
if (DC->isDependentContext () && isa<CXXRecordDecl>(DC) &&
1303
- Name.getCXXOverloadedOperator () == OO_Equal &&
1304
- !R.isTemplateNameLookup ()) {
1303
+ Name.getCXXOverloadedOperator () == OO_Equal) {
1305
1304
R.setNotFoundInCurrentInstantiation ();
1306
1305
return false ;
1307
1306
}
@@ -2472,8 +2471,10 @@ bool Sema::LookupQualifiedName(LookupResult &R, DeclContext *LookupCtx,
2472
2471
}
2473
2472
} QL (LookupCtx);
2474
2473
2475
- bool TemplateNameLookup = R.isTemplateNameLookup ();
2476
2474
CXXRecordDecl *LookupRec = dyn_cast<CXXRecordDecl>(LookupCtx);
2475
+ // FIXME: Per [temp.dep.general]p2, an unqualified name is also dependent
2476
+ // if it's a dependent conversion-function-id or operator= where the current
2477
+ // class is a templated entity. This should be handled in LookupName.
2477
2478
if (!InUnqualifiedLookup && !R.isForRedeclaration ()) {
2478
2479
// C++23 [temp.dep.type]p5:
2479
2480
// A qualified name is dependent if
@@ -2487,7 +2488,7 @@ bool Sema::LookupQualifiedName(LookupResult &R, DeclContext *LookupCtx,
2487
2488
(Name.getNameKind () == DeclarationName::CXXConversionFunctionName &&
2488
2489
Name.getCXXNameType ()->isDependentType ()) ||
2489
2490
(Name.getCXXOverloadedOperator () == OO_Equal && LookupRec &&
2490
- LookupRec->isDependentContext () && !TemplateNameLookup )) {
2491
+ LookupRec->isDependentContext ())) {
2491
2492
R.setNotFoundInCurrentInstantiation ();
2492
2493
return false ;
2493
2494
}
@@ -2583,6 +2584,8 @@ bool Sema::LookupQualifiedName(LookupResult &R, DeclContext *LookupCtx,
2583
2584
return true ;
2584
2585
};
2585
2586
2587
+ bool TemplateNameLookup = R.isTemplateNameLookup ();
2588
+
2586
2589
// Determine whether two sets of members contain the same members, as
2587
2590
// required by C++ [class.member.lookup]p6.
2588
2591
auto HasSameDeclarations = [&](DeclContext::lookup_iterator A,
0 commit comments