OSDN Git Service

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