<div dir="ltr"><div style>Change LGTM, thanks.</div><div><br></div><div>+    if (ClassTemplatePartialSpecializationDecl* MD =</div><div>+              dyn_cast_or_null<ClassTemplatePartialSpecializationDecl>(*II)) {</div>
<div>+      TemplateParamScopeStack.push_back(new ParseScope(this,</div><div>+                                                 Scope::TemplateParamScope));</div><div>+      Actions.ActOnReenterTemplateScope(getCurScope(), MD);</div>
<div>+    } else if (CXXRecordDecl* MD = dyn_cast_or_null<CXXRecordDecl>(*II)) {</div><div>+      TemplateParamScopeStack.push_back(new ParseScope(this,</div><div>+                                                  Scope::TemplateParamScope,</div>
<div>+                                     MD->getDescribedClassTemplate() != 0 ));</div><div><br></div><div style>Can you fix the formatting of this code too? :) There's some strange indentation here (probably due to 80-column limits) and an extra space after the 0. Also a typo "outmost" should be "outermost".</div>
</div><div class="gmail_extra"><br><br><div class="gmail_quote">On Wed, Apr 24, 2013 at 3:42 AM, Will Wilson <span dir="ltr"><<a href="mailto:will@indefiant.com" target="_blank">will@indefiant.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">*ping* Anyone available for a quick review of this patch?<div><br></div><div>Cheers,</div><div>Will.</div>
</div><div class="gmail_extra"><div><div class="h5"><br><br><div class="gmail_quote">On 19 April 2013 21:18, Will Wilson <span dir="ltr"><<a href="mailto:will@indefiant.com" target="_blank">will@indefiant.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 All,</div><div><br></div><div>This patch attempts to resolve an issue seen when a CXXMethodDecl (produced via a ClassScopeFunctionSpecializationDecl) is encountered with -fdelayed-template-parsing enabled. This is needed to successfully compile the VS2012 xlocnum header (see: class numpunct) which is used by a number of other core MS STL headers .</div>


















<div><br></div><div>The existing logic in Parser::ParseLateTemplatedFuncDef() uses a special case if the FunctionDecl was a Declarator with template parameter lists, in which case most of the parent scope was ignored. Unfortunately this is the code path used by CXXMethodDecl's generated from ClassScopeFunctionSpecializationDecl's. This would break name lookup for parameter's named in the parent context:</div>


<div><br></div><div>  test/SemaTemplate/ms-function-specialization-class-scope.cpp:55:4: error:</div><div>      unknown type name 'T'</div><div>          T a = 3;</div><div>          ^</div><div><br></div><div>
The approach I've taken may be missing a lower-level issue, as it simply attempts to ensure the parent lookup scope is always restored. Oddly, there seems to be a number of checks for ClassTemplatePartialSpecializationDecl in the delayed template parsing code that never get called - is this evidence that the design changed at some time?</div>


<div><br></div><div>Either way, this patch seems to resolve the issue and passes all existing tests. I've also added an additional test run to ms-function-specialization-class-scope.cpp with -fdelayed-template-parsing enabled in order to reproduce the original issue.</div>

<span><font color="#888888">
<div><br></div><div>- Will.</div><div><br></div>
</font></span></div>
</blockquote></div><br><br clear="all"><div><br></div></div></div><span class="HOEnZb"><font color="#888888">-- <br><div><span style="color:rgb(68,68,68);font-family:Arial,Helvetica,sans-serif"><b>Indefiant Ltd.</b></span></div>
<div><font color="#444444" face="Arial, Helvetica, sans-serif"><span style="font-size:12px"><b><br>
</b></span></font></div><font color="#444444" face="Arial, Helvetica, sans-serif"><span style="font-size:12px">Firsby Lodge, New Main Road, Scamblesby, Louth, Lincs LN11 9XH UK<br></span></font><div style="padding-left:0px;padding-right:0px;padding-top:0px;margin-right:0px;margin-left:0px;margin-bottom:0px;margin-top:0px;padding-bottom:0px">

<span style="color:rgb(68,68,68);font-family:Arial,Helvetica,sans-serif;font-size:x-small"><i>Tel: <a href="tel:%2B44%2020%208123%207663" value="+442081237663" target="_blank">+44 20 8123 7663</a> England Registered No. 07936820 VAT No. </i></span><span style="background-color:transparent"><font color="#444444" face="Arial, Helvetica, sans-serif" size="1"><i>128556202</i></font></span></div>


</font></span></div>
<br>_______________________________________________<br>
cfe-commits mailing list<br>
<a href="mailto:cfe-commits@cs.uiuc.edu">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>