15096 – [3.3/3.4/4.0 Regression] parse error with templates and pointer to const member (original) (raw)
Description Wolfgang Roehrl 2004-04-23 10:54:37 UTC
We use the compiler to generate code for a PowerPc processor. Used invokation line for the C++ compiler:
ccppc -c -x c++ -ansi -Wall -Werror -mcpu=8540 -fverbose-asm -mbig -mmultiple -mno-string -mstrict-align -O3 -fno-exceptions -fno-rtti -I -D<differen #define's> Z.CPP -oZ.O
// example program 1
template class C1 { public: C1 (); ~C1 (); const int C1::* getPtr () const;
private: int x; T_ y; };
template const int C1::* C1::getPtr () const { return &C1::x; } // <-- line 17
The compiler gives the following error message:
z.CPP:17: error: too few template parameter lists in declaration of `const int C1::* C1::getPtr() const'
We get no error message if a typedef is introduced:
// example program 2
template class C1 { typedef const int C1::* T_C1_INT_PTR;
public: C1 (); ~C1 (); T_C1_INT_PTR getPtr () const;
private: int x; T_ y; };
template typename C1::T_C1_INT_PTR C1::getPtr () const { return &C1::x; }
Comment 1 Giovanni Bajo 2004-04-23 13:11:09 UTC
Confirmed, but can anybody test it with 2.95?
Comment 2 Drea Pinski 2004-04-23 13:15:39 UTC
It worked with 2.95.3
Comment 3 Giovanni Bajo 2004-06-06 03:39:25 UTC
Retargeting to 3.4.1, being a regression on that release branch.
Comment 4 Mark Mitchell 2004-06-12 21:32:16 UTC
Working on a fix.
Comment 7 Mark Mitchell 2004-06-14 17:15:13 UTC
Fixed in GCC 3.4.1.