This revision was landed with ongoing or failed builds. This revision was automatically updated to reflect the committed changes. Closed by commit rG54be300f7e0b: [Clang] Fix Sema::ClassifyName so that it classifies EnumConstantDecl as… (authored by shafik). Herald added a project: clang.
Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D138091/new/ https://reviews.llvm.org/D138091 Files: clang/docs/ReleaseNotes.rst clang/lib/Sema/SemaDecl.cpp clang/test/SemaCXX/cxx20-using-enum.cpp Index: clang/test/SemaCXX/cxx20-using-enum.cpp =================================================================== --- clang/test/SemaCXX/cxx20-using-enum.cpp +++ clang/test/SemaCXX/cxx20-using-enum.cpp @@ -240,4 +240,33 @@ } // namespace Thirteen +namespace GH58057 { +struct Wrap { +enum Things { + Value1, + Value2 +}; +}; + +using enum Wrap::Things; + +int f() { + return (Value1 | Value2); +} +} + +namespace GH59014 { +struct X { + enum Masks {Mask = 1,Shift = 0}; +}; + +void f(int a) { + using enum X::Masks; + + auto u = (Mask); + auto v = (Mask << Shift); + void (~(Mask)); +} +} + #endif Index: clang/lib/Sema/SemaDecl.cpp =================================================================== --- clang/lib/Sema/SemaDecl.cpp +++ clang/lib/Sema/SemaDecl.cpp @@ -1247,7 +1247,8 @@ // member accesses, as we need to defer certain access checks until we know // the context. 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()); // Otherwise, this is an overload set that we will need to resolve later. Index: clang/docs/ReleaseNotes.rst =================================================================== --- clang/docs/ReleaseNotes.rst +++ clang/docs/ReleaseNotes.rst @@ -306,6 +306,11 @@ `Issue 58229 <https://github.com/llvm/llvm-project/issues/58229>`_ - The builtin type trait ``__is_aggregate`` now returns ``true`` for arrays of incomplete types in accordance with the suggested fix for `LWG3823 <https://cplusplus.github.io/LWG/issue3823>`_ +- Fix bug with using enum that could lead to enumerators being treated as if + they were part of an overload set. This fixes + `Issue 58067 <https://github.com/llvm/llvm-project/issues/58057>`_ + `Issue 59014 <https://github.com/llvm/llvm-project/issues/59014>`_ + `Issue 54746 <https://github.com/llvm/llvm-project/issues/54746>`_ Improvements to Clang's diagnostics ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Index: clang/test/SemaCXX/cxx20-using-enum.cpp =================================================================== --- clang/test/SemaCXX/cxx20-using-enum.cpp +++ clang/test/SemaCXX/cxx20-using-enum.cpp @@ -240,4 +240,33 @@ } // namespace Thirteen +namespace GH58057 { +struct Wrap { +enum Things { + Value1, + Value2 +}; +}; + +using enum Wrap::Things; + +int f() { + return (Value1 | Value2); +} +} + +namespace GH59014 { +struct X { + enum Masks {Mask = 1,Shift = 0}; +}; + +void f(int a) { + using enum X::Masks; + + auto u = (Mask); + auto v = (Mask << Shift); + void (~(Mask)); +} +} + #endif Index: clang/lib/Sema/SemaDecl.cpp =================================================================== --- clang/lib/Sema/SemaDecl.cpp +++ clang/lib/Sema/SemaDecl.cpp @@ -1247,7 +1247,8 @@ // member accesses, as we need to defer certain access checks until we know // the context. 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()); // Otherwise, this is an overload set that we will need to resolve later. Index: clang/docs/ReleaseNotes.rst =================================================================== --- clang/docs/ReleaseNotes.rst +++ clang/docs/ReleaseNotes.rst @@ -306,6 +306,11 @@ `Issue 58229 <https://github.com/llvm/llvm-project/issues/58229>`_ - The builtin type trait ``__is_aggregate`` now returns ``true`` for arrays of incomplete types in accordance with the suggested fix for `LWG3823 <https://cplusplus.github.io/LWG/issue3823>`_ +- Fix bug with using enum that could lead to enumerators being treated as if + they were part of an overload set. This fixes + `Issue 58067 <https://github.com/llvm/llvm-project/issues/58057>`_ + `Issue 59014 <https://github.com/llvm/llvm-project/issues/59014>`_ + `Issue 54746 <https://github.com/llvm/llvm-project/issues/54746>`_ Improvements to Clang's diagnostics ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits