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

            Bug ID: 78924
           Summary: hiding of template parameter of member template
           Product: gcc
           Version: 5.4.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: litteras at ukr dot net
  Target Milestone: ---

due to http://eel.is/c++draft/temp.res#temp.local-7 :

"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). [ Example:

template<class T> struct A {
  struct B { /* ... */ };
  typedef void C;
  void f();
  template<class U> void g(U);
};

template<class B> void A<B>::f() {
  B b;              // A's B, not the template parameter
}

template<class B> template<class C> void A<B>::g(C) {
  B b;              // A's B, not the template parameter
  C c;              // the template parameter C, not A's C
}
— end example ]"

when i'm trying to compile the example, following errors occurs :

"template-bug-report.cxx:34:42: error: prototype for ‘void A<T>::g()’ does not
match any in class ‘A<T>’

template-bug-report.cxx:27:26: error: candidate is: template<class T>
template<class U> void A<T>::g(U)"

(compiler treats C in A<B>::g(C) as A's member name)

Reply via email to