<div dir="ltr"><div>+  assert( Actions.getDiagnostics().hasErrorOccurred() || </div><div>+        (!dyn_cast<FunctionTemplateDecl>(LM.D) || </div><div>+          (dyn_cast<FunctionTemplateDecl>(LM.D)->getTemplateParameters()-></div>
<div>+              getDepth() < TemplateParameterDepth)) && "TemplateParameterDepth"</div><div>+              " should be greater than the depth of current template being"</div><div>+              " instantiated!");</div>
<div><br></div><div style>No space after (, extra space on the next line, and this will generate a || versus && precedence warning. Also, would be more consistent to reflow the string literal to start on its own line.</div>
<div style><br></div><div style><div>+    // getNumTemplateParameterLists returns the number of TPLs </div><div>+    // minus the TPL of the actual function being instantiated</div><div>+    // i.e. consider a nested member class template with</div>
<div>+    // a template member of a function defined out of class ... its</div><div>+    // associated TPLs</div><div>+    // Therefore we add 1 to the depth for the Declarator itself</div><div>+    // and the rest for the outer TPLs returned by getNumTPLs</div>
<div><br></div><div style>Something seems to be missing from the first part of this comment. In any case, IIRC there's a patch in flight which removes this code and makes it call ActOnReenterTemplateScope the right number of times.</div>
</div><div style><br></div><div style>+    CurTemplateDepthTracker.addDepth( 1 + NumTPLs );<br></div><div style><br></div><div style>No spaces inside parens.</div><div style><br></div><div style><div>A   if (Tok.is(tok::kw_try)) {</div>
<div><br></div><div style>Random 'A' in the patch?</div></div><div style><br></div><div style><div>+      assert( (!FunTmplD || </div><div>+          (FunTmplD->getTemplateParameters()->getDepth() </div><div>
+              < TemplateParameterDepth)) && "TemplateParameterDepth should "</div><div>+              " be greater than the depth of current template being "</div><div>+              "instantiated!");</div>
<div><br></div><div style>No space inside parens, and please start the string literal on a new line.</div></div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Thu, Apr 25, 2013 at 12:08 PM, Faisal Vali <span dir="ltr"><<a href="mailto:faisalv@gmail.com" target="_blank">faisalv@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div>Hi Richard, <br>  let me know what you think of this patch to address the template parameter depth tracking issue.<br>
</div>thanks!<span class="HOEnZb"><font color="#888888"><br></font></span><div><div class="gmail_extra"><span class="HOEnZb"><font color="#888888"><br clear="all"><div>Faisal Vali<br><br>
</div></font></span><div><div class="h5">
<br><br><div class="gmail_quote">On Mon, Apr 22, 2013 at 8:01 AM, Richard Smith <span dir="ltr"><<a href="mailto:richard@metafoo.co.uk" target="_blank">richard@metafoo.co.uk</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">

<div dir="ltr">Hi Faisal,<div><br></div><div>I'd prefer putting the TemplateParameterDepthRAII code next to the calls to ActOnReenterTemplateScope (unless there's some reason for them to be separated?). If you increase the depth once for each ActOnReenterTemplateScope call, there shouldn't ever be a need to bump it by more than one. That should also handle the cases of a generic lambda in a default argument in a method or class template, and a generic lambda / local class w/member template in a non-template function in a class template, which I think the current patch won't get right.<br>


<div><br></div><div><div>+  // ok here we need to make sure that the depth of the template parameter list</div><div>+  // of a potential member function template is adjusted for the template</div><div>+  // parameter depth - in case we have local classes with member templates</div>


<div class="gmail_extra"><br></div><div class="gmail_extra">Please start comments with a capital letter and end them with a full stop. Also drop the "ok" :)</div><div class="gmail_extra"><br></div><div class="gmail_extra">


<div class="gmail_extra">+  TemplateParameterDepthRAII CurTemplateDepthTracker(TemplateParameterDepth);</div><div class="gmail_extra">+  FunctionTemplateDecl *FTD = 0;</div><div class="gmail_extra">+  if (LM.TemplateScope && (FTD = dyn_cast<FunctionTemplateDecl>(LM.D))) {</div>


<div class="gmail_extra">+    TemplateParameterList *TPL = FTD->getTemplateParameters();</div><div class="gmail_extra">+    unsigned MemberTemplateDepth = TPL->getDepth();</div><div class="gmail_extra">+    while( TemplateParameterDepth <= MemberTemplateDepth )</div>


<div class="gmail_extra"><br></div><div class="gmail_extra">Space after "while", no spaces immediately inside parens.</div><div class="gmail_extra"><br></div><div class="gmail_extra">Index: test/CXX/generic-lambdas/fv_print.h<br>


</div><div class="gmail_extra"><br></div><div class="gmail_extra">Subdirectories inside test/CXX should correspond to sections of the standard. The test itself should be cleaned up prior to commit: remove the printf-based testing mechanism, and don't use lli. If you really want to test CodeGen rather than just Sema (and I think you can avoid that), you should FileCheck the -emit-llvm output. Otherwise, try to craft a -verify test, and put it in test/SemaTemplate.</div>


<div class="gmail_extra"><br></div><div class="gmail_extra">Thanks!</div><div class="gmail_extra"><br></div><div class="gmail_quote"><div><div>On Mon, Apr 22, 2013 at 4:40 AM, Faisal Vali <span dir="ltr"><<a href="mailto:faisalv@gmail.com" target="_blank">faisalv@gmail.com</a>></span> wrote:<br>


</div></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div><div><div dir="ltr"><div><div>
Hi Doug,<br></div>    I had mentioned this issue to you briefly in Bristol having to do tangentially with generic lambdas: the template parameter depth does not get calculated correctly when local member templates are parsed.  This patch addresses that issue.  I know local member templates are not standard, but some of the machinery I will be using to implement incrementing depth appropriately within generic lambdas is included.  This only addresses the issue of template argument deduction for local member templates - other issues (and i don't remember what they are exactly now - i think you had showed me an example in Portland...) will probably get addressed as the generic lambda implementation moves along (if we care to fix local member templates entirely that is).<br>



<br></div><div>Will refine the patch based on feedback.<br><br></div>Thanks!<span><font color="#888888"><br><div> <br clear="all"><div><div><div>Faisal Vali<br><br></div>
</div></div></div></font></span></div>
<br></div></div>_______________________________________________<br>
cfe-commits mailing list<br>
<a href="mailto:cfe-commits@cs.uiuc.edu" target="_blank">cfe-commits@cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits</a><br>
<br></blockquote></div><br></div></div></div></div>
</blockquote></div><br></div></div></div></div></div>
</blockquote></div><br></div>