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

bonzini at gcc dot gnu dot org gcc-bugzilla@gcc.gnu.org
Thu Sep 29 08:34:00 GMT 2005


------- Additional Comments From bonzini at gcc dot gnu dot org  2005-09-29 08:34 -------
> 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);
> };

However strange it may seem, this is not valid C++.

See http://gcc.gnu.org/ml/gcc-patches/2005-02/msg00043.html

Paolo

-- 


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



More information about the Gcc-bugs mailing list