btw, what I eventually want is to know "whether it's in template declaration or not" in Parser::ParseCXXNewExpression().  If there's an easier way to do it, I wonder if someone could tell me that.<div><br>

</div><div>Thanks.<div><br><div class="gmail_quote">On Tue, May 22, 2012 at 5:27 PM, Dai Mikurube <span dir="ltr"><<a href="mailto:dmikurube@chromium.org" target="_blank">dmikurube@chromium.org</a>></span> wrote:<br>

<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi cfe-dev,<div><br></div><div>I'm hacking on Clang and have a trouble about template scope.  Should 'Scope::TemplateParamScope (*1)' be turned on while parsing entire template declarations, or not?</div>

<div><br>
</div><div>The description "Template parameter scope starts at the 'template' keyword and ends when the template declaration ends." (*1) sounds like it should be true.  I found that the flag is, however, sometimes turned off.  I wonder if I could know whether it's expected behavior or not.  (If it's not good behavior, I'm thinking about fixing it.)</div>


<div><br></div><div><br></div><div>Let's think about the following simple template function.</div><div><br></div><div>template<typename T></div><div><div>Object* make(T a) {</div><div>  return new Object(&a);</div>


<div>}</div></div><div><br></div><div>I expected 'TemplateParamScope' is on while parsing the 'new' expression above.  But, it's actually turned off since the Scope is overwritten in ParseFunctionDefinition at (*2).</div>


<div><br></div><div>(*1) TemplateParamScope: <a href="http://clang.llvm.org/doxygen/classclang_1_1Scope.html#afa7e82b8e23f84d0d73e27953b9afab7a40ab45d2b9c9fca9a32b710f457d449a" target="_blank">http://clang.llvm.org/doxygen/classclang_1_1Scope.html#afa7e82b8e23f84d0d73e27953b9afab7a40ab45d2b9c9fca9a32b710f457d449a</a></div>


<div><div>(*2) <a href="http://clang.llvm.org/doxygen/Parser_8cpp_source.html#l00975" target="_blank">http://clang.llvm.org/doxygen/Parser_8cpp_source.html#l00975</a></div><div><br></div><div><br></div><div>Thanks in advance.</div>

<span class="HOEnZb"><font color="#888888"><div><br>
</div>-- <br><div>Dai MIKURUBE</div><div>   <a href="mailto:dmikurube@chromium.org" target="_blank">dmikurube@chromium.org</a></div><br>
</font></span></div>
</blockquote></div><br><br clear="all"><div><br></div>-- <br><div>Dai MIKURUBE</div><div>   <a href="mailto:dmikurube@chromium.org" target="_blank">dmikurube@chromium.org</a></div><br>
</div></div>