aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--clang/docs/ReleaseNotes.rst4
-rw-r--r--clang/lib/Sema/SemaDeclCXX.cpp2
-rw-r--r--clang/test/SemaCXX/cxx20-using-enum.cpp14
3 files changed, 18 insertions, 2 deletions
diff --git a/clang/docs/ReleaseNotes.rst b/clang/docs/ReleaseNotes.rst
index ca00a80..b6af43c 100644
--- a/clang/docs/ReleaseNotes.rst
+++ b/clang/docs/ReleaseNotes.rst
@@ -776,8 +776,10 @@ Bug Fixes in This Version
- In C23, something like ``[[/*possible attributes*/]];`` is an attribute
declaration, not a statement. So it is not allowed by the syntax in places
where a statement is required, specifically as the secondary block of a
- selection or iteration statement. This differs from C++, since C++ allows
+ selection or iteration statement. This differs from C++, since C++ allows
declaration statements. Clang now emits a warning for these patterns. (#GH141659)
+- Fixed false positives for redeclaration errors of using enum in
+ nested scopes. (#GH147495)
Bug Fixes to Compiler Builtins
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
diff --git a/clang/lib/Sema/SemaDeclCXX.cpp b/clang/lib/Sema/SemaDeclCXX.cpp
index a49a8ab..5cc92eb 100644
--- a/clang/lib/Sema/SemaDeclCXX.cpp
+++ b/clang/lib/Sema/SemaDeclCXX.cpp
@@ -13308,7 +13308,7 @@ NamedDecl *Sema::BuildUsingEnumDeclaration(Scope *S, AccessSpecifier AS,
LookupResult Previous(*this, UsingEnumName, LookupUsingDeclName,
RedeclarationKind::ForVisibleRedeclaration);
- LookupName(Previous, S);
+ LookupQualifiedName(Previous, CurContext);
for (NamedDecl *D : Previous)
if (UsingEnumDecl *UED = dyn_cast<UsingEnumDecl>(D))
diff --git a/clang/test/SemaCXX/cxx20-using-enum.cpp b/clang/test/SemaCXX/cxx20-using-enum.cpp
index 14ef4b2..775b65c 100644
--- a/clang/test/SemaCXX/cxx20-using-enum.cpp
+++ b/clang/test/SemaCXX/cxx20-using-enum.cpp
@@ -274,4 +274,18 @@ void f(int a) {
}
}
+namespace GH147495 {
+struct S {
+ enum class E { A };
+ using enum E;
+
+ struct S1 {
+ using enum E;
+ };
+
+ struct S2 {
+ using E::A;
+ };
+};
+}
#endif