OSDN Git Service

PR rtl-optimization/23454
[pf3gnuchains/gcc-fork.git] / gcc / testsuite / g++.dg / opt / static3.C
1 // { dg-do link }
2 // { dg-options "-O2" }
3
4 class Foo {
5 public:
6   // No out-of-class definition is provided for these class members.
7   // That's technically a violation of the standard, but no diagnostic
8   // is required, and, as a QOI issue, we should optimize away all
9   // references.
10   static const int erf = 0;
11   static const int foo = 1;
12 };
13
14 int one()
15 {
16   return Foo::foo;
17 }
18
19 int two()
20 {
21   return Foo::foo + Foo::erf;
22 }
23
24 int three(int x)
25 {
26   return x ? Foo::erf : Foo::foo;
27 }
28
29 int i;
30
31 int main ()
32 {
33   one ();
34   two ();
35   three (i);
36 }