Skip to content

Commit eb65b73

Browse files
committed
Revert "[Clang][Sema] Fix template name lookup for operator= (llvm#90999)"
This reverts commit 3191e0b.
1 parent 7b2f3da commit eb65b73

File tree

2 files changed

+7
-22
lines changed

2 files changed

+7
-22
lines changed

clang/lib/Sema/SemaLookup.cpp

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1300,8 +1300,7 @@ bool Sema::CppLookupName(LookupResult &R, Scope *S) {
13001300
for (Scope *PreS = S; PreS; PreS = PreS->getParent())
13011301
if (DeclContext *DC = PreS->getEntity()) {
13021302
if (DC->isDependentContext() && isa<CXXRecordDecl>(DC) &&
1303-
Name.getCXXOverloadedOperator() == OO_Equal &&
1304-
!R.isTemplateNameLookup()) {
1303+
Name.getCXXOverloadedOperator() == OO_Equal) {
13051304
R.setNotFoundInCurrentInstantiation();
13061305
return false;
13071306
}
@@ -2472,8 +2471,10 @@ bool Sema::LookupQualifiedName(LookupResult &R, DeclContext *LookupCtx,
24722471
}
24732472
} QL(LookupCtx);
24742473

2475-
bool TemplateNameLookup = R.isTemplateNameLookup();
24762474
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.
24772478
if (!InUnqualifiedLookup && !R.isForRedeclaration()) {
24782479
// C++23 [temp.dep.type]p5:
24792480
// A qualified name is dependent if
@@ -2487,7 +2488,7 @@ bool Sema::LookupQualifiedName(LookupResult &R, DeclContext *LookupCtx,
24872488
(Name.getNameKind() == DeclarationName::CXXConversionFunctionName &&
24882489
Name.getCXXNameType()->isDependentType()) ||
24892490
(Name.getCXXOverloadedOperator() == OO_Equal && LookupRec &&
2490-
LookupRec->isDependentContext() && !TemplateNameLookup)) {
2491+
LookupRec->isDependentContext())) {
24912492
R.setNotFoundInCurrentInstantiation();
24922493
return false;
24932494
}
@@ -2583,6 +2584,8 @@ bool Sema::LookupQualifiedName(LookupResult &R, DeclContext *LookupCtx,
25832584
return true;
25842585
};
25852586

2587+
bool TemplateNameLookup = R.isTemplateNameLookup();
2588+
25862589
// Determine whether two sets of members contain the same members, as
25872590
// required by C++ [class.member.lookup]p6.
25882591
auto HasSameDeclarations = [&](DeclContext::lookup_iterator A,

clang/test/CXX/temp/temp.res/temp.dep/temp.dep.type/p4.cpp

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -453,24 +453,6 @@ namespace N3 {
453453
this->A::operator=(*this);
454454
}
455455
};
456-
457-
template<typename T>
458-
struct C {
459-
template<typename U>
460-
void operator=(int);
461-
462-
void not_instantiated() {
463-
operator=<int>(0);
464-
C::operator=<int>(0);
465-
this->operator=<int>(0);
466-
this->C::operator=<int>(0);
467-
468-
operator=(*this);
469-
C::operator=(*this);
470-
this->operator=(*this);
471-
this->C::operator=(*this);
472-
}
473-
};
474456
} // namespace N3
475457

476458
namespace N4 {

0 commit comments

Comments
 (0)