This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c++/87842] New: Member of class template hides template parameter of another member


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

            Bug ID: 87842
           Summary: Member of class template hides template parameter of
                    another member
           Product: gcc
           Version: 8.2.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: o_kniemeyer at maxon dot net
  Target Milestone: ---

The following code example from C++17 standard 17.6.1.7 does not compile:

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
}

This is because GCC uses A's C instead of the template parameter C of A::g.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]