]> granicus.if.org Git - clang/commitdiff
Use static_cast<> instead of cast<> in Decl::Destroy(). Suggestion by Argiris
authorSam Bishop <sam@bishop.dhs.org>
Sun, 13 Apr 2008 04:32:18 +0000 (04:32 +0000)
committerSam Bishop <sam@bishop.dhs.org>
Sun, 13 Apr 2008 04:32:18 +0000 (04:32 +0000)
Kirtzidis!

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49603 91177308-0d34-0410-b5e6-96231b3b80d8

lib/AST/Decl.cpp

index bcb117dbc65f64be51d759bed182e67b2a52ebff..ac1a593e6f952d255ed68a1d99352404c9204c32 100644 (file)
@@ -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!");