This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/23437] [3.4/4.0/4.1 Regression] error: ... cannot appear in a constant-expression
- From: "pannuri at cavs dot msstate dot edu" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 12 Sep 2005 18:39:20 -0000
- Subject: [Bug c++/23437] [3.4/4.0/4.1 Regression] error: ... cannot appear in a constant-expression
- References: <20050817093929.23437.jmihalicza@graphisoft.com>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- 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