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]
Other format: [Raw text]

[Bug c++/23437] [3.4/4.0/4.1 Regression] error: ... cannot appear in a constant-expression


------- Additional Comments From pannuri at cavs dot msstate dot edu  2005-09-12 18:39 -------
It seems this works:
#include <math.h>
 #include <stdio.h>

 static const double PI = M_PI;
 static const double TWO_PI = (2.0*PI);
 static const double HALF_PI = (M_PI_2);
 static const double QUARTER_PI = (M_PI_4);

 main (int argc, char** argv) {
  int i = 0;
  printf("%ld\n", i);
  return 0;
 }

But putting these inside of a class doesn't work:

class Foo {
  Foo(){};
  ~Foo(){};
  static const double PI = M_PI;
  static const double TWO_PI = (2.0*PI);
  static const double HALF_PI = (M_PI_2);
  static const double QUARTER_PI = (M_PI_4);
};

-Madhulika 

-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=23437


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