On Jun 1, 2011, at 5:15 AM, Michael Han wrote:

> Hi there, I find a clang warning is suspicious.
>  
> Consider this code:          
>  
> template <typename T1> struct A {
>     template <typename T2> struct B {
>         template <typename T3> struct C {
>             static void foo();
>         };
>     };
> };
>  
> template <> struct A<int> {
>     template <typename T2> struct B {
>         template <typename T3> struct C {
>             static void foo();
>         };
>     };
> };
>  
> template <> template <typename T3> struct A<int>::B<int>::C {
>     static void foo();
> };
>  
> Clang would emit a warning like “extraneous template parameter list in 
> template specialization” at
> template <> template <typename T3> struct A<int>::B<int>::C. I think the code 
> should not trigger a warning here since the first template <> is applied to 
> the explicit specialization of the nested class template B, not to A as 
> indicated by the “note” of clang diagnostic (since A has already had a 
> declaration of an explicit specialization so the template <> for A could be 
> omitted)
>  
> After looking at the code, it looks like the problem is in SemaTemplate.cpp 
> when iterating the nested types, the loop is terminated before it should be 
> so the template header is never consumed. The attached patch fixes this, with 
> a test added.
>  
> Please review, thanks!

This looks great, thanks! I've committed it as r132431.

        - Doug
_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits

Reply via email to