Skip to content

Commit 427ad84

Browse files
sdkrystianyxsamliu
authored andcommitted
Cherry-pick missing part of [Clang][Sema] Revert changes to operator= lookup (llvm#91620)
This patch cherry-pick missing part of 75ebcbf. Fixes: SWDEV-520199 The original commit message is: [Clang][Sema] Revert changes to operator= lookup in templated classes from llvm#91498, llvm#90999, and llvm#90152 (llvm#91620) This reverts changes in llvm#91498, llvm#90999, and llvm#90152 which make `operator=` dependent whenever the current class is templated. Change-Id: I352db5cc20ecf4a0ccdbb921c63da0867651ffc4
1 parent f26e346 commit 427ad84

File tree

2 files changed

+4
-26
lines changed

2 files changed

+4
-26
lines changed

clang/lib/Sema/SemaExprMember.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -984,7 +984,10 @@ Sema::BuildMemberReferenceExpr(Expr *BaseExpr, QualType BaseExprType,
984984
// build a CXXDependentScopeMemberExpr.
985985
if (R.wasNotFoundInCurrentInstantiation() ||
986986
(IsArrow && !BaseExprType->isPointerType() &&
987-
BaseExprType->isDependentType()))
987+
BaseExprType->isDependentType()) ||
988+
(R.getLookupName().getCXXOverloadedOperator() == OO_Equal &&
989+
(SS.isSet() ? SS.getScopeRep()->isDependent()
990+
: BaseExprType->isDependentType())))
988991
return ActOnDependentMemberExpr(BaseExpr, BaseExprType, IsArrow, OpLoc, SS,
989992
TemplateKWLoc, FirstQualifierInScope,
990993
R.getLookupNameInfo(), TemplateArgs);

clang/lib/Sema/SemaLookup.cpp

Lines changed: 0 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1281,31 +1281,6 @@ bool Sema::CppLookupName(LookupResult &R, Scope *S) {
12811281
if (DeclContext *DC = PreS->getEntity())
12821282
DeclareImplicitMemberFunctionsWithName(*this, Name, R.getNameLoc(), DC);
12831283
}
1284-
// C++23 [temp.dep.general]p2:
1285-
// The component name of an unqualified-id is dependent if
1286-
// - it is a conversion-function-id whose conversion-type-id
1287-
// is dependent, or
1288-
// - it is operator= and the current class is a templated entity, or
1289-
// - the unqualified-id is the postfix-expression in a dependent call.
1290-
if (Name.getNameKind() == DeclarationName::CXXConversionFunctionName &&
1291-
Name.getCXXNameType()->isDependentType()) {
1292-
R.setNotFoundInCurrentInstantiation();
1293-
return false;
1294-
}
1295-
1296-
// If this is the name of an implicitly-declared special member function,
1297-
// go through the scope stack to implicitly declare
1298-
if (isImplicitlyDeclaredMemberFunctionName(Name)) {
1299-
for (Scope *PreS = S; PreS; PreS = PreS->getParent())
1300-
if (DeclContext *DC = PreS->getEntity()) {
1301-
if (DC->isDependentContext() && isa<CXXRecordDecl>(DC) &&
1302-
Name.getCXXOverloadedOperator() == OO_Equal) {
1303-
R.setNotFoundInCurrentInstantiation();
1304-
return false;
1305-
}
1306-
DeclareImplicitMemberFunctionsWithName(*this, Name, R.getNameLoc(), DC);
1307-
}
1308-
}
13091284

13101285
// C++23 [temp.dep.general]p2:
13111286
// The component name of an unqualified-id is dependent if

0 commit comments

Comments
 (0)