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]

bool bug? Pls confirm.


Is the bool initialization code broken?  Can someone pls confirm whether this 
is a bug or not.  If its not, I want to change my code.

The following code does not work with egcs-1.0.1 or with gcc-2.7.2.X
for that matter.  But if you uncomment the 'const int' line and comment out 
the 'const bool' line, then it compiles fine.

% g++ -c b.cc
b.cc:6: field initializer is not constant

--- b.cc ---
struct X
{ 
//  static const int   is_signed  =  true  ;
  static const bool   is_signed  =  true  ;

  static const int digits = is_signed ? 8 *sizeof(wchar_t)-1 : 0;

};


% g++ -c c.cc

--- c.cc ---
struct X
{ 
  static const int   is_signed  =  true  ;
//  static const bool   is_signed  =  true  ;

  static const int digits = is_signed ? 8 *sizeof(wchar_t)-1 : 0;

};









Cheers,
Glenn                                  
--------------------
Glenn R. Kronschnabl
Applied Research Laboratories        | grk@arlut.utexas.edu (PGP/MIME ok)
The University of Texas at Austin    | http://www.arlut.utexas.edu/~grk
PO Box 8029, Austin, TX 78713-8029   | (Ph) 512.835.3642 (FAX) 512.835.3808
10,000 Burnet Road, Austin, TX 78758 | ... but an Aggie at heart!



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