From: Douglas Gregor Date: Sun, 22 May 2011 00:21:10 +0000 (+0000) Subject: Add an assertion to tell us when we're going off the deep end trying X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=93104c10653cf03a3eb5996a1650a9a9e25e0811;p=clang Add an assertion to tell us when we're going off the deep end trying to determine outer template arguments lists for template parameters. This is actually the problem behind PR9643, which I have yet to figure out how to fix. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@131822 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Sema/SemaTemplateInstantiate.cpp b/lib/Sema/SemaTemplateInstantiate.cpp index 564f099ad9..907a7e24a9 100644 --- a/lib/Sema/SemaTemplateInstantiate.cpp +++ b/lib/Sema/SemaTemplateInstantiate.cpp @@ -58,9 +58,13 @@ Sema::getTemplateInstantiationArgs(NamedDecl *D, Result.addOuterTemplateArguments(Innermost); DeclContext *Ctx = dyn_cast(D); - if (!Ctx) + if (!Ctx) { Ctx = D->getDeclContext(); - + + assert((!D->isTemplateParameter() || !Ctx->isTranslationUnit()) && + "Template parameter doesn't have its context yet!"); + } + while (!Ctx->isFileContext()) { // Add template arguments from a class template instantiation. if (ClassTemplateSpecializationDecl *Spec