]> granicus.if.org Git - clang/commitdiff
Don't do delayed exception-specification checking on an invalid
authorDouglas Gregor <dgregor@apple.com>
Fri, 1 Feb 2013 04:49:10 +0000 (04:49 +0000)
committerDouglas Gregor <dgregor@apple.com>
Fri, 1 Feb 2013 04:49:10 +0000 (04:49 +0000)
class. Fixes <rdar://problem/13017229>.

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

lib/Sema/SemaDeclCXX.cpp
test/CXX/except/except.spec/p14.cpp

index 9ef91467dac5bef8e1ebb94751e4523a1ef422e0..ead7b6548b95b492254c729a8dcbaa50d6675f4a 100644 (file)
@@ -7871,6 +7871,14 @@ void Sema::DefineImplicitDestructor(SourceLocation CurrentLocation,
 /// \brief Perform any semantic analysis which needs to be delayed until all
 /// pending class member declarations have been parsed.
 void Sema::ActOnFinishCXXMemberDecls() {
+  // If the context is an invalid C++ class, just suppress these checks.
+  if (CXXRecordDecl *Record = dyn_cast<CXXRecordDecl>(CurContext)) {
+    if (Record->isInvalidDecl()) {
+      DelayedDestructorExceptionSpecChecks.clear();
+      return;
+    }
+  }
+
   // Perform any deferred checking of exception specifications for virtual
   // destructors.
   for (unsigned i = 0, e = DelayedDestructorExceptionSpecChecks.size();
index ff21ab8e56b92e28c98602129249f2b50e7987d3..99ed2fdee19d9f54f126ca09aa1c98122cb7500a 100644 (file)
@@ -101,3 +101,14 @@ namespace PR14141 {
     ~Derived3() noexcept(true) = default; // expected-error {{does not match the calculated}}
   };
 }
+
+namespace rdar13017229 {
+  struct Base {
+    virtual ~Base() {}
+  };
+  
+  struct Derived : Base {
+    virtual ~Derived();
+    Typo foo(); // expected-error{{unknown type name 'Typo'}}
+  };
+}