[Bug c++/21373] New: Strange error message on reference to static const member initialized via cast
pkoning at equallogic dot com
gcc-bugzilla@gcc.gnu.org
Tue May 3 21:39:00 GMT 2005
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.
--
Summary: Strange error message on reference to static const
member initialized via cast
Product: gcc
Version: 4.0.0
Status: UNCONFIRMED
Severity: normal
Priority: P2
Component: c++
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: pkoning at equallogic dot com
CC: gcc-bugs at gcc dot gnu dot org
GCC build triplet: i686-pc-linux-gnu
GCC host triplet: i686-pc-linux-gnu
GCC target triplet: i686-pc-linux-gnu
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=21373
More information about the Gcc-bugs
mailing list