r174145 - Don't do delayed exception-specification checking on an invalid

Douglas Gregor dgregor at apple.com
Thu Jan 31 20:49:10 PST 2013


Author: dgregor
Date: Thu Jan 31 22:49:10 2013
New Revision: 174145

URL: http://llvm.org/viewvc/llvm-project?rev=174145&view=rev
Log:
Don't do delayed exception-specification checking on an invalid
class. Fixes <rdar://problem/13017229>.

Modified:
    cfe/trunk/lib/Sema/SemaDeclCXX.cpp
    cfe/trunk/test/CXX/except/except.spec/p14.cpp

Modified: cfe/trunk/lib/Sema/SemaDeclCXX.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDeclCXX.cpp?rev=174145&r1=174144&r2=174145&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaDeclCXX.cpp (original)
+++ cfe/trunk/lib/Sema/SemaDeclCXX.cpp Thu Jan 31 22:49:10 2013
@@ -7871,6 +7871,14 @@ void Sema::DefineImplicitDestructor(Sour
 /// \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();

Modified: cfe/trunk/test/CXX/except/except.spec/p14.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CXX/except/except.spec/p14.cpp?rev=174145&r1=174144&r2=174145&view=diff
==============================================================================
--- cfe/trunk/test/CXX/except/except.spec/p14.cpp (original)
+++ cfe/trunk/test/CXX/except/except.spec/p14.cpp Thu Jan 31 22:49:10 2013
@@ -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'}}
+  };
+}





More information about the cfe-commits mailing list