diff options
-rw-r--r-- | lib/Sema/SemaDeclCXX.cpp | 8 | ||||
-rw-r--r-- | test/CXX/except/except.spec/p14.cpp | 11 |
2 files changed, 19 insertions, 0 deletions
diff --git a/lib/Sema/SemaDeclCXX.cpp b/lib/Sema/SemaDeclCXX.cpp index 9ef91467da..ead7b6548b 100644 --- a/lib/Sema/SemaDeclCXX.cpp +++ b/lib/Sema/SemaDeclCXX.cpp @@ -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(); diff --git a/test/CXX/except/except.spec/p14.cpp b/test/CXX/except/except.spec/p14.cpp index ff21ab8e56..99ed2fdee1 100644 --- a/test/CXX/except/except.spec/p14.cpp +++ b/test/CXX/except/except.spec/p14.cpp @@ -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'}} + }; +} |