1 // { dg-do run }
2 
3 // Copyright (C) 2003 Free Software Foundation, Inc.
4 // Contributed by Nathan Sidwell 6 Sep 2003 <nathan@codesourcery.com>
5 // Origin: Volker Reichelt <reichelt@igpm.rwth-aachen.de>
6 
7 // PR c++/11788 we failed to instantiate a decl, and we lost some side
8 // effects
9 
10 static int flag = 0;
11 
12 template <typename> struct A
13 {
activeA14   A &active () { flag++; static A a; return a; }
15 
fooA16   static void foo() {}
17 
barA18   static void bar () {}
barA19   static void bar (int) {}
20 
21   int m;
22 };
23 
baz()24 void (*baz ()) ()
25 {
26     A<int> a;
27     return &a.active ().foo;
28 }
29 
boz()30 void (*boz ()) ()
31 {
32     A<int> a;
33     return &a.active ().bar;
34 }
35 
buz()36 int *buz ()
37 {
38   A<int> a;
39 
40   return &a.active ().m;
41 }
42 
main()43 int main ()
44 {
45   baz ();
46   boz ();
47   buz ();
48 
49   return flag != 3;
50 }
51