-
Notifications
You must be signed in to change notification settings - Fork 14.9k
[clang] fix obtaining EnumDecl for UsingEnumDecl #156127
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Use the castAs acessor for the type for a UsingEnumDecl, as it can be sugar for an EnumType. Fixes a regression reported here: #155313 (comment) Since this regression was never released, there are no release notes.
@llvm/pr-subscribers-clang Author: Matheus Izvekov (mizvekov) ChangesUse the castAs acessor for the type for a UsingEnumDecl, as it can be sugar for an EnumType. Fixes a regression reported here: #155313 (comment) Since this regression was never released, there are no release notes. Full diff: https://github.com/llvm/llvm-project/pull/156127.diff 2 Files Affected:
diff --git a/clang/include/clang/AST/DeclCXX.h b/clang/include/clang/AST/DeclCXX.h
index 00d8f724671f1..8802664031d37 100644
--- a/clang/include/clang/AST/DeclCXX.h
+++ b/clang/include/clang/AST/DeclCXX.h
@@ -3826,7 +3826,7 @@ class UsingEnumDecl : public BaseUsingDecl, public Mergeable<UsingEnumDecl> {
public:
EnumDecl *getEnumDecl() const {
- return cast<clang::EnumType>(EnumType->getType())->getOriginalDecl();
+ return EnumType->getType()->castAs<clang::EnumType>()->getOriginalDecl();
}
static UsingEnumDecl *Create(ASTContext &C, DeclContext *DC,
diff --git a/clang/test/SemaTemplate/using-decl.cpp b/clang/test/SemaTemplate/using-decl.cpp
index 1ef2a2dfaa019..d54d3a3f3ea9e 100644
--- a/clang/test/SemaTemplate/using-decl.cpp
+++ b/clang/test/SemaTemplate/using-decl.cpp
@@ -14,3 +14,15 @@ namespace UsingInGenericLambda {
}
void e() { c<int>(); }
}
+
+namespace UsingUsingEnum {
+ namespace foo {
+ enum class EnumOne {};
+ }
+ using foo::EnumOne;
+
+ template <class> void t() {
+ using enum EnumOne;
+ }
+ template void t<void>();
+} // namespace UsingUsingEnum
|
LLVM Buildbot has detected a new failure on builder Full details are available at: https://lab.llvm.org/buildbot/#/builders/190/builds/26434 Here is the relevant piece of the build log for the reference
|
LLVM Buildbot has detected a new failure on builder Full details are available at: https://lab.llvm.org/buildbot/#/builders/88/builds/15562 Here is the relevant piece of the build log for the reference
|
Use the castAs acessor for the type for a UsingEnumDecl, as it can be sugar for an EnumType.
Fixes a regression reported here: #155313 (comment)
Since this regression was never released, there are no release notes.