gcc version: g++ (GCC) 4.1.1 20061011 (Red Hat 4.1.1-30) Copyright (C) 2006 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. ----------------source code------------------------------------ #include <stdio.h> class Base { public: int type; Base(int type) {this->type = type;} void showtype() {printf("%d\n",type);} }; template<int type> class Derived : public Base { public: Derived(); }; template<int type> Derived<type>::Derived() : Base(type) { } template<int TYPE> class Derived2 : public Base { public: Derived2(); }; template<int TYPE> Derived2<TYPE>::Derived2() : Base(TYPE) { } enum { ZERO = 0, NONZERO = 1, }; typedef Derived<NONZERO> NonZeroClass; typedef Derived2<NONZERO> NonZeroClass2; int main() { NonZeroClass tmp; tmp.showtype(); NonZeroClass2 tmp2; tmp2.showtype(); } -----------------source code end------------------------------- ----------------output------------------------------ 165643296 1 ---------------output end---------------------------- the only difference between Derived and Derived2 is that Derived's template parameter is the same as Base's data member(they are both type). The output to me is a surprise. i do not know whether it is a bug, so just post it here 3x for your attention.