]> granicus.if.org Git - clang/commitdiff
Add an assertion to tell us when we're going off the deep end trying
authorDouglas Gregor <dgregor@apple.com>
Sun, 22 May 2011 00:21:10 +0000 (00:21 +0000)
committerDouglas Gregor <dgregor@apple.com>
Sun, 22 May 2011 00:21:10 +0000 (00:21 +0000)
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

lib/Sema/SemaTemplateInstantiate.cpp

index 564f099ad9fb7d1ed3f147454ca1504de57ceadf..907a7e24a912d04055d4eb7d06d757e20ba16661 100644 (file)
@@ -58,9 +58,13 @@ Sema::getTemplateInstantiationArgs(NamedDecl *D,
     Result.addOuterTemplateArguments(Innermost);
   
   DeclContext *Ctx = dyn_cast<DeclContext>(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