OSDN Git Service

PR c++/34774
[pf3gnuchains/gcc-fork.git] / gcc / testsuite / g++.dg / opt / static5.C
1 // PR c++/31809
2 // { dg-do run }
3 // { dg-options "-O2" }
4
5 struct S
6 {
7   unsigned v;
8   static inline S f (unsigned a);
9 };
10
11 inline S
12 S::f (unsigned a)
13 {
14   static S t = { a };
15   return t;
16 }
17
18 const static S s = S::f (26);
19
20 extern "C" void abort (void);
21
22 int
23 main ()
24 {
25   S t = s;
26   if (t.v != 26)
27     abort ();
28   return 0;
29 }