This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
BUG : expression evaluation in template definition
- To: egcs-bugs at egcs dot cygnus dot com
- Subject: BUG : expression evaluation in template definition
- From: "Volker H. Simonis" <simonis at informatik dot uni-tuebingen dot de>
- Date: Mon, 03 May 1999 10:46:06 +0200
- Organization: WSI - CA
consider the following example :
template<class T, bool b>
class RestrictedSize {};
int main() {
RestrictedSize<int, (sizeof(int) == 4)> v1; // OK
RestrictedSize<int, sizeof(int) <= 4> v2; // OK
//RestrictedSize<int, sizeof(int) == 4> v3; // should be OK, but compiler
} // error "`v3' undeclared .."
RestrictedSize<int, (sizeof(int) == 4)> can be instantiated only with
the expression "(sizeof(int) == 4)" in parenthesis, while for example
the expression "sizeof(int) <= 4" works without.
This bug appears as in the egcs 1.1 release (egcs-2.91.57 19980901) as well
as in the latest snapshot i could get (egcs-2.93.18 19990412)
For convenience i also attach the offending example as stand alone file.
Volker Simonis
simonis@informatik.uni-tuebingen.de
egcs_bug.cpp