[cfe-commits] r98440 - in /cfe/trunk: lib/Sema/SemaDeclCXX.cpp test/SemaCXX/PR6562.cpp

Rafael Espindola rafael.espindola at gmail.com
Sat Mar 13 10:12:56 PST 2010


Author: rafael
Date: Sat Mar 13 12:12:56 2010
New Revision: 98440

URL: http://llvm.org/viewvc/llvm-project?rev=98440&view=rev
Log:
Fix PR6562. If a type is dependent, we don't know if it will have implicit
destructors.


Added:
    cfe/trunk/test/SemaCXX/PR6562.cpp
Modified:
    cfe/trunk/lib/Sema/SemaDeclCXX.cpp

Modified: cfe/trunk/lib/Sema/SemaDeclCXX.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDeclCXX.cpp?rev=98440&r1=98439&r2=98440&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaDeclCXX.cpp (original)
+++ cfe/trunk/lib/Sema/SemaDeclCXX.cpp Sat Mar 13 12:12:56 2010
@@ -1658,6 +1658,11 @@
         continue;
       CXXRecordDecl *BaseClassDecl =
           cast<CXXRecordDecl>(RT->getDecl());
+
+      // We don't know if a dependent type will have an implicit destructor.
+      if (BaseClassDecl->isDependentType())
+        continue;
+
       if (BaseClassDecl->hasTrivialDestructor())
         continue;
       CXXDestructorDecl *DD = BaseClassDecl->getDestructor(Context);

Added: cfe/trunk/test/SemaCXX/PR6562.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/PR6562.cpp?rev=98440&view=auto
==============================================================================
--- cfe/trunk/test/SemaCXX/PR6562.cpp (added)
+++ cfe/trunk/test/SemaCXX/PR6562.cpp Sat Mar 13 12:12:56 2010
@@ -0,0 +1,10 @@
+// RUN: %clang_cc1 -fsyntax-only -verify %s
+
+struct X { ~X(); };
+template <typename T>
+struct A {
+  struct B { X x; };
+  struct C : public B {
+    C() : B() { }
+  };
+};





More information about the cfe-commits mailing list