1 // { dg-do run }
2 // { dg-additional-sources " comdat2-aux.cc" }
3 // { dg-options "-O" }
4 // Test that statics in inline functions are unified between
5 // translation units. Currently we handle this by just suppressing
6 // inling and relying on unification of the function itself.
7
8 template <class T>
9 struct S {
fS10 static int f ()
11 {
12 static int i;
13 return ++i;
14 }
SS15 S () {};
~SS16 ~S () {};
17 };
18
19 typedef S<int> a;
20
21 int g ();
22
main()23 int main ()
24 {
25 if (a::f() != 1
26 || g() != 2
27 || a::f() != 3)
28 return 1;
29 return 0;
30 }
31