r184581 - Propagate the invalid bit from bases to derived template classes.
Matt Beaumont-Gay
matthewbg at google.com
Fri Jun 21 11:58:32 PDT 2013
Author: matthewbg
Date: Fri Jun 21 13:58:32 2013
New Revision: 184581
URL: http://llvm.org/viewvc/llvm-project?rev=184581&view=rev
Log:
Propagate the invalid bit from bases to derived template classes.
Fixes PR16292.
Modified:
cfe/trunk/lib/Sema/SemaTemplateInstantiate.cpp
cfe/trunk/test/SemaTemplate/derived.cpp
Modified: cfe/trunk/lib/Sema/SemaTemplateInstantiate.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaTemplateInstantiate.cpp?rev=184581&r1=184580&r2=184581&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaTemplateInstantiate.cpp (original)
+++ cfe/trunk/lib/Sema/SemaTemplateInstantiate.cpp Fri Jun 21 13:58:32 2013
@@ -1754,6 +1754,10 @@ Sema::SubstBaseSpecifiers(CXXRecordDecl
Base = Pattern->bases_begin(), BaseEnd = Pattern->bases_end();
Base != BaseEnd; ++Base) {
if (!Base->getType()->isDependentType()) {
+ if (const CXXRecordDecl *RD = Base->getType()->getAsCXXRecordDecl()) {
+ if (RD->isInvalidDecl())
+ Instantiation->setInvalidDecl();
+ }
InstantiatedBases.push_back(new (Context) CXXBaseSpecifier(*Base));
continue;
}
Modified: cfe/trunk/test/SemaTemplate/derived.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaTemplate/derived.cpp?rev=184581&r1=184580&r2=184581&view=diff
==============================================================================
--- cfe/trunk/test/SemaTemplate/derived.cpp (original)
+++ cfe/trunk/test/SemaTemplate/derived.cpp Fri Jun 21 13:58:32 2013
@@ -28,3 +28,12 @@ namespace rdar13267210 {
}
};
}
+
+namespace PR16292 {
+ class IncompleteClass; // expected-note{{forward declaration}}
+ class BaseClass {
+ IncompleteClass Foo; // expected-error{{field has incomplete type}}
+ };
+ template<class T> class DerivedClass : public BaseClass {};
+ void* p = new DerivedClass<void>;
+}
More information about the cfe-commits
mailing list