g++ 3.0.2 template parser too eager to error out
Leonid A Broukhis
leob@mailcom.com
Wed Jan 9 20:27:00 GMT 2002
The following program compiles, links and prints 25 when compiled with
Sun WorkShop 6 update 2 C++ 5.3, or with
Edison Design Group C/C++ Front End, version 2.43.1, but fails miserably
when compiled with gcc version 3.0.2:
template<class T> struct C {
typedef T qq;
enum { ww = 7 };
};
template<> struct C<int> {
enum { qq = 5 };
typedef int ww;
};
template<class T> struct D {
enum { qq = C<T>::qq * 5};
typedef typename C<T>::ww ww;
};
#include <iostream>
using namespace std;
int main() {
D<int>::ww x = D<int>::qq;
cout << x << endl;
return 0;
}
More information about the Gcc-bugs
mailing list