diff options
author | Richard Smith <richard-llvm@metafoo.co.uk> | 2012-07-11 22:37:56 +0000 |
---|---|---|
committer | Richard Smith <richard-llvm@metafoo.co.uk> | 2012-07-11 22:37:56 +0000 |
commit | ded9c2ee92f6d9b65ed211070c0c34119bd30969 (patch) | |
tree | 72e8f0cb06fd781c66126d73b87013413ce38ec2 /clang/lib/Sema/SemaTemplateInstantiate.cpp | |
parent | 3d46052d90dc5f9a0e145c0531b0a74a845c39e4 (diff) | |
download | bcm5719-llvm-ded9c2ee92f6d9b65ed211070c0c34119bd30969.tar.gz bcm5719-llvm-ded9c2ee92f6d9b65ed211070c0c34119bd30969.zip |
Stop instantiating a class if we hit a static_assert failure. Also, if the
static_assert fails when parsing the template, don't diagnose it again on every
instantiation.
llvm-svn: 160088
Diffstat (limited to 'clang/lib/Sema/SemaTemplateInstantiate.cpp')
-rw-r--r-- | clang/lib/Sema/SemaTemplateInstantiate.cpp | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/clang/lib/Sema/SemaTemplateInstantiate.cpp b/clang/lib/Sema/SemaTemplateInstantiate.cpp index 239a0d73ebc..0a0016c50b3 100644 --- a/clang/lib/Sema/SemaTemplateInstantiate.cpp +++ b/clang/lib/Sema/SemaTemplateInstantiate.cpp @@ -1904,7 +1904,7 @@ Sema::InstantiateClass(SourceLocation PointOfInstantiation, continue; if ((*Member)->isInvalidDecl()) { - Instantiation->setInvalidDecl(); + Instantiation->setInvalidDecl(); continue; } @@ -1928,6 +1928,13 @@ Sema::InstantiateClass(SourceLocation PointOfInstantiation, MSInfo->setTemplateSpecializationKind(TSK_ImplicitInstantiation); MSInfo->setPointOfInstantiation(PointOfInstantiation); } + } else if (StaticAssertDecl *SA = dyn_cast<StaticAssertDecl>(NewMember)) { + if (SA->isFailed()) { + // A static_assert failed. Bail out; instantiating this + // class is probably not meaningful. + Instantiation->setInvalidDecl(); + break; + } } if (NewMember->isInvalidDecl()) |