summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--clang/lib/AST/Decl.cpp7
1 files changed, 5 insertions, 2 deletions
diff --git a/clang/lib/AST/Decl.cpp b/clang/lib/AST/Decl.cpp
index bcb117dbc65..ac1a593e6f9 100644
--- a/clang/lib/AST/Decl.cpp
+++ b/clang/lib/AST/Decl.cpp
@@ -329,7 +329,10 @@ const Attr *Decl::getAttrs() const {
return (*DeclAttrs)[this];
}
-#define CASE(KIND) case KIND: cast<KIND##Decl>(this)->~KIND##Decl(); break
+#define CASE(KIND) \
+ case KIND: \
+ static_cast<KIND##Decl *>(const_cast<Decl *>(this))->~KIND##Decl(); \
+ break
void Decl::Destroy(ASTContext& C) const {
switch (getKind()) {
@@ -355,7 +358,7 @@ void Decl::Destroy(ASTContext& C) const {
CASE(LinkageSpec);
case Struct: case Union: case Class:
- cast<RecordDecl>(this)->~RecordDecl();
+ static_cast<RecordDecl *>(const_cast<Decl *>(this))->~RecordDecl();
break;
default: assert(0 && "Unknown decl kind!");
OpenPOWER on IntegriCloud