https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80890
Bug ID: 80890 Summary: Qualified class member access in a member initialization Product: gcc Version: 5.4.1 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: sergi.mateo at bsc dot es Target Milestone: --- The following C++11 code doesn't compile with g++ 5.4.1, although it compiles fine with g++ 6: template < typename _K, typename _V > class A { int x; int *px = &x; // OK int *qx = &this->x; // OK int *rx = &(*this).x; // OK int *sx = &((*this).::A<_K, _V>::x); // OK int *tx = &(*this).::A<_K, _V>::x; // KO }; The error message is the following one: g++ -c t1.cc -std=c++11 t1.cc:9:36: error: expected ‘;’ at end of member declaration int *tx = &(*this).::A<_K, _V>::x; // KO ^ t1.cc:9:36: error: declaration of ‘int A<_K, _V>::_V’ t1.cc:1:25: error: shadows template parm ‘class _V’ template < typename _K, typename _V > ^ t1.cc:9:38: error: expected unqualified-id before ‘>’ token int *tx = &(*this).::A<_K, _V>::x; // KO ^ t1.cc:9:32: error: wrong number of template arguments (1, should be 2) int *tx = &(*this).::A<_K, _V>::x; // KO ^ t1.cc:2:8: note: provided for ‘template<class _K, class _V> class A’ class A Best regards, Sergi