>>>>> "Glenn" == Glenn R Kronschnabl <grk@arlut.utexas.edu> writes:
Glenn> Is the bool initialization code broken? Can someone pls
Glenn> confirm whether this is a bug or not. If its not, I want
Glenn> to change my code.
Glenn> The following code does not work with egcs-1.0.1 or with
Glenn> gcc-2.7.2.X for that matter. But if you uncomment the
Glenn> 'const int' line and comment out the 'const bool' line,
Glenn> then it compiles fine.
Yes, this is a bug.
Glenn> % g++ -c b.cc b.cc:6: field initializer is not constant
Glenn> --- b.cc --- struct X { // static const int is_signed =
Glenn> true ; static const bool is_signed = true ;
Glenn> static const int digits = is_signed ? 8
Glenn> *sizeof(wchar_t)-1 : 0;
Glenn> };
Glenn> % g++ -c c.cc
Glenn> --- c.cc --- struct X { static const int is_signed = true ;
Glenn> // static const bool is_signed = true ;
Glenn> static const int digits = is_signed ? 8
Glenn> *sizeof(wchar_t)-1 : 0;
Glenn> };
Glenn> Cheers, Glenn -------------------- Glenn R. Kronschnabl
Glenn> Applied Research Laboratories | grk@arlut.utexas.edu
Glenn> (PGP/MIME ok) The University of Texas at Austin |
Glenn> http://www.arlut.utexas.edu/~grk PO Box 8029, Austin, TX
Glenn> 78713-8029 | (Ph) 512.835.3642 (FAX) 512.835.3808 10,000
Glenn> Burnet Road, Austin, TX 78758 | ... but an Aggie at heart!
--
Mark Mitchell mmitchell@usa.net
Stanford University http://www.stanford.edu