<div dir="ltr">Thanks Richard.<div><br></div><div>I have been analyzing the code so as to find a way to fix this. </div><div>I suppose the function needs to add a check for the same.</div><div><br></div><div>static std::pair<DeclContext *, bool> findOuterContext(Scope *S);</div>
<div><br></div><div>Can you give me a few pointers on how to approach fixing this bug?</div><div><br></div><div>Thanks,</div><div>Rahul</div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Wed, Nov 27, 2013 at 2:48 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"><div><div class="h5">On Tue, Nov 26, 2013 at 10:26 AM, Rahul Jain <span dir="ltr"><<a href="mailto:1989.rahuljain@gmail.com" target="_blank">1989.rahuljain@gmail.com</a>></span> wrote:<br>
</div></div><div class="gmail_extra"><div class="gmail_quote"><div><div class="h5">
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><br><div>Hi all,</div><div><br></div><div>This is with respect to the following test case:</div><div><br>

</div><div><div>struct A {</div><div>    struct B { typedef int X; };</div><div>};</div><div><br></div>
<div>template<class B> struct C : A {</div><div>    B::X q; // Ok: A::B.</div><div>    struct U { typedef int X; };</div><div>    template<class U></div><div>        struct D;</div><div>};</div><div><br></div>


<div>template<class B></div><div>template<class U></div><div>struct C<B>::D {</div><div>    typename U::X r; // { dg-error "" }</div><div>};</div><div><br></div><div>C<int>::D<double> y;</div>


<div><br></div></div><div>As far as I am able to make out, this code compiles fine with Clang, because the statement   typename U::X r; resolves for U by looking up the class members first and than the template parameter list.</div>


<div> </div><div>But isnt it supposed to throw an error based on the following wordings from the standard (The wordings in the bracket are of interest to us):</div><div><br></div><div><div>In the definition of a member of a class template that appears outside of the class template definition, the name of a member of the class template hides the name of a template-parameter of any enclosing class templates (but not a template-parameter of the member if the member is a class or function template).</div>


<div><br></div><div><br></div><div>Note: The below mentioned example is from the standards.</div><div><br></div><div>Example:</div><div><br></div><div>template<class T> struct A {</div><div>struct B { /* ... */ };</div>


<div>typedef void C;</div><div>void f();</div><div>template<class U> void g(U);</div><div>};</div><div><br></div><div>template<class B> void A<B>::f() {</div><div>B b;   // A’s B, not the template parameter</div>


<div>}</div><div><br></div><div>template<class B> template<class C> void A<B>::g(C) {</div><div>B b; // A’s B, not the template parameter</div><div>C c; // the template parameter C, not A’s C , this is the case I suppose we           are not handling</div>


<div>}</div></div><div><br></div><div><br></div><div>Am I missing something in my analysis or is this a potential bug??</div></div></blockquote><div><br></div></div></div><div>Yes, this is a bug.</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div class="im">
<div dir="ltr"><div>Inputs on this would be really helpful.</div><div><br></div><div>Thanks,</div>
<div>Rahul</div><div><br></div><div><br></div><div><br></div></div>
<br></div>_______________________________________________<br>
cfe-dev mailing list<br>
<a href="mailto:cfe-dev@cs.uiuc.edu" target="_blank">cfe-dev@cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev</a><br>
<br></blockquote></div><br></div></div>
</blockquote></div><br></div>