[PATCH] D138091: [Clang] Fix Sema::ClassifyName so that it classifies EnumConstantDecl as NonType when they are brought into scope via using enum

Shafik Yaghmour via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Nov 28 19:05:49 PST 2022


shafik marked an inline comment as done.
shafik added inline comments.


================
Comment at: clang/lib/Sema/SemaDecl.cpp:1250-1251
   bool ADL = UseArgumentDependentLookup(SS, Result, NextToken.is(tok::l_paren));
-  if (Result.isSingleResult() && !ADL && !FirstDecl->isCXXClassMember())
+  if (Result.isSingleResult() && !ADL &&
+      (!FirstDecl->isCXXClassMember() || isa<EnumConstantDecl>(FirstDecl)))
     return NameClassification::NonType(Result.getRepresentativeDecl());
----------------
aaron.ballman wrote:
> This change looks correct to me -- enum constants are class members but are certainly not forming an overload set!
> 
> Did you audit the other places we call `isCXXClassMember()` to ensure they're sensible regarding enum constant declarations?
I had not but after looking I don't see any other locations that need modifying.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D138091/new/

https://reviews.llvm.org/D138091



More information about the cfe-commits mailing list