This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/87842] New: Member of class template hides template parameter of another member
- From: "o_kniemeyer at maxon dot net" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Thu, 01 Nov 2018 10:00:26 +0000
- Subject: [Bug c++/87842] New: Member of class template hides template parameter of another member
- Auto-submitted: auto-generated
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.