aboutsummaryrefslogtreecommitdiff
path: root/lib/Sema/SemaTemplateInstantiateDecl.cpp
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2010-02-16 19:28:15 +0000
committerDouglas Gregor <dgregor@apple.com>2010-02-16 19:28:15 +0000
commit2fa98001f832836e3f652c211a9d2f80501d659a (patch)
treeaf1d8cd0f51e69b398508d2e81729f8e572731ce /lib/Sema/SemaTemplateInstantiateDecl.cpp
parent124b878dba5007df0a268ea128a6ad8dc5dd2c5e (diff)
Do not try to instantiate invalid declarations. It's a recipe for
disaster. Fixes PR6161. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@96371 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/SemaTemplateInstantiateDecl.cpp')
-rw-r--r--lib/Sema/SemaTemplateInstantiateDecl.cpp3
1 files changed, 3 insertions, 0 deletions
diff --git a/lib/Sema/SemaTemplateInstantiateDecl.cpp b/lib/Sema/SemaTemplateInstantiateDecl.cpp
index 0b0efcb833..f13bd69453 100644
--- a/lib/Sema/SemaTemplateInstantiateDecl.cpp
+++ b/lib/Sema/SemaTemplateInstantiateDecl.cpp
@@ -1304,6 +1304,9 @@ Decl * TemplateDeclInstantiator
Decl *Sema::SubstDecl(Decl *D, DeclContext *Owner,
const MultiLevelTemplateArgumentList &TemplateArgs) {
TemplateDeclInstantiator Instantiator(*this, Owner, TemplateArgs);
+ if (D->isInvalidDecl())
+ return 0;
+
return Instantiator.Visit(D);
}