Test program: template <class T> class foo { public: static const unsigned long long max = (T)~0ULL; bool toobig (unsigned long long val) { return val > max; } }; Message: test.cc: In member function ‘bool foo<T>::toobig(long long unsigned int)’: test.cc:7: error: ‘T’ used where a ‘long long unsigned int’ was expected The baffling part is that T doesn't occur anywhere in or near line 7. It's almost as if the initialization part of the static const member has been textually substituted in line 7 -- but if it were that should still be legal... It works ok if I explicitly initialize the member outside the class definition via specializations, which is tolerable given that only a small number of cases of this template class are used.
Confirmed: t.cc: In member function âbool foo<T>::toobig(long long unsigned int)â: t.cc:7: internal compiler error: tree check: expected record_type or union_type or qual_union_type, have template_type_parm in lookup_conversions, at cp/search.c:2407 Please submit a full bug report, with preprocessed source if appropriate. See <URL:http://gcc.gnu.org/bugs.html> for instructions. But this is a dup of bug 21165. *** This bug has been marked as a duplicate of 21165 ***