aboutsummaryrefslogtreecommitdiff
path: root/lib/Sema/SemaTemplateInstantiateDecl.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'lib/Sema/SemaTemplateInstantiateDecl.cpp')
-rw-r--r--lib/Sema/SemaTemplateInstantiateDecl.cpp8
1 files changed, 5 insertions, 3 deletions
diff --git a/lib/Sema/SemaTemplateInstantiateDecl.cpp b/lib/Sema/SemaTemplateInstantiateDecl.cpp
index 577c2c28c4..3473c87709 100644
--- a/lib/Sema/SemaTemplateInstantiateDecl.cpp
+++ b/lib/Sema/SemaTemplateInstantiateDecl.cpp
@@ -3031,9 +3031,11 @@ NamedDecl *Sema::FindInstantiatedDecl(SourceLocation Loc, NamedDecl *D,
}
// UsingShadowDecls can instantiate to nothing because of using hiding.
- assert((Result || isa<UsingShadowDecl>(D) || D->isInvalidDecl() ||
- cast<Decl>(ParentDC)->isInvalidDecl())
- && "Unable to find instantiation of declaration!");
+ // Note: this assertion end up firing in invalid code even when none of the
+ // AST invariants have been broken, so we explicitly check whether any
+ // errors have been emitted
+ assert((Result || isa<UsingShadowDecl>(D) || Diags.hasErrorOccurred()) &&
+ "Unable to find instantiation of declaration!");
D = Result;
}