]> granicus.if.org Git - clang/commitdiff
More fixes/tests.
authorDavid Blaikie <dblaikie@gmail.com>
Tue, 24 Jan 2012 04:29:31 +0000 (04:29 +0000)
committerDavid Blaikie <dblaikie@gmail.com>
Tue, 24 Jan 2012 04:29:31 +0000 (04:29 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@148777 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Analysis/CFG.cpp
test/SemaCXX/warn-unreachable.cpp

index c760d49899d63fcfc64ea83f72c40b0939bf5c8b..c7040fc6d45f1813d4de3fb4af3f80e6738a5c3e 100644 (file)
@@ -721,7 +721,7 @@ void CFGBuilder::addAutomaticObjDtors(LocalScope::const_iterator B,
     }
     
     const CXXDestructorDecl *Dtor = Ty->getAsCXXRecordDecl()->getDestructor();
-    if (cast<FunctionType>(Dtor->getType())->getNoReturnAttr())
+    if (Dtor && cast<FunctionType>(Dtor->getType())->getNoReturnAttr())
       Block = createNoReturnBlock();
     else
       autoCreateBlock();
@@ -864,7 +864,7 @@ LocalScope* CFGBuilder::addLocalScopeForVarDecl(VarDecl *VD,
 
   // Check if type is a C++ class with non-trivial destructor.
   if (const CXXRecordDecl *CD = QT->getAsCXXRecordDecl())
-    if (!CD->hasTrivialDestructor()) {
+    if (CD->hasDefinition() && !CD->hasTrivialDestructor()) {
       // Add the variable to scope
       Scope = createOrReuseLocalScope(Scope);
       Scope->addVar(VD);
index 52da0b922e1e46733d8ee3cbcbcd3a7f5094912c..59b6bf9f3013a27fdefa97e3b8b450f2ca4c2ff4 100644 (file)
@@ -132,3 +132,12 @@ template<int a>
 struct aligned_storage : imp<a> {
  ~aligned_storage() { }
 };
+
+// is this valid?
+template<typename T>
+class outer {
+  class inner;
+  void func() {
+    inner t;
+  }
+};