[clang] [Clang][Sema] Fix lookup of dependent operator= outside of complete-class contexts (PR #91498)

Krystian Stasiowski via cfe-commits cfe-commits at lists.llvm.org
Wed May 8 12:58:49 PDT 2024


================
@@ -1269,19 +1269,19 @@ struct FindLocalExternScope {
 };
 } // end anonymous namespace
 
+static bool isDependentAssignmentOperator(DeclarationName Name,
+                                          DeclContext *LookupContext) {
+  auto *LookupRecord = dyn_cast_if_present<CXXRecordDecl>(LookupContext);
+  return Name.getCXXOverloadedOperator() == OO_Equal && LookupRecord &&
+         !LookupRecord->isBeingDefined() && LookupRecord->isDependentContext();
----------------
sdkrystian wrote:

(I'll add a test which calls `operator=` with a non-dependent argument -- in that case it will be diagnosed before the template is instantiated)

https://github.com/llvm/llvm-project/pull/91498


More information about the cfe-commits mailing list