https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86501

            Bug ID: 86501
           Summary: shadow template parameter
           Product: gcc
           Version: 8.1.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: zhonghao at pku dot org.cn
  Target Milestone: ---

The code is as follows:

template < int V >
struct A
{ 
 struct B
 { 
 template < int > friend struct V; 
 };
};

A < 0 >::B a;

g++ accepts the code, but clang++ rejects it:

error: declaration of 'V' shadows template parameter
     template < int > friend struct V; 
                                    ^
note: template parameter is declared here
    template < int V >
                   ^
    1 error generated.

Reply via email to