[cfe-commits] r131822 - /cfe/trunk/lib/Sema/SemaTemplateInstantiate.cpp

Douglas Gregor dgregor at apple.com
Sat May 21 17:21:10 PDT 2011


Author: dgregor
Date: Sat May 21 19:21:10 2011
New Revision: 131822

URL: http://llvm.org/viewvc/llvm-project?rev=131822&view=rev
Log:
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.

Modified:
    cfe/trunk/lib/Sema/SemaTemplateInstantiate.cpp

Modified: cfe/trunk/lib/Sema/SemaTemplateInstantiate.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaTemplateInstantiate.cpp?rev=131822&r1=131821&r2=131822&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaTemplateInstantiate.cpp (original)
+++ cfe/trunk/lib/Sema/SemaTemplateInstantiate.cpp Sat May 21 19:21:10 2011
@@ -58,9 +58,13 @@
     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





More information about the cfe-commits mailing list