This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

BUG : expression evaluation in template definition


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]