1// { dg-do assemble  }
2// { dg-options "-ansi -pedantic-errors -Winline -O1" }
3
4// Copyright (C) 2000 Free Software Foundation, Inc.
5// Contributed by Nathan Sidwell 9 Mar 2000 <nathan@codesourcery.com>
6
7// derived from a bug report by Benjamin Kosnik <bkoz@cygnus.com>
8
9// __FUNCTION__ was erroneously causing us to issue a `cannot inline'
10// diagnostic, even though we'd (a) inlined it, (b) been forced to issue an
11// out of line body by taking it's address, (c) not used __FUNCTION__.
12
13inline void wibble ()
14{}
15
16inline void wobble ()
17{}                          // { dg-bogus "" } cannot inline
18
19void bar (void (*)());
20
21void bar1 ()
22{
23  wibble ();                // can be inlined
24  void (*ptr) () = wobble;  // force out of line issue
25
26  bar (ptr);                // make sure we make use of it
27}
28
29struct B
30{
31  void mwibble ()
32  {};
33  void mwobble ()
34  {};                       // { dg-bogus "" } cannot inline
35
36  static void swibble ()
37  {};
38  static void swobble ()
39  {};                       // { dg-bogus "" } cannot inline
40};
41
42void bar (void (B::*)());
43
44void bar2 ()
45{
46  B::swibble ();                  // can be inlined
47  void (*ptr) () = &B::swobble;   // force out of line issue
48
49  bar (ptr);                      // make sure we make use of it
50}
51
52void bar3 (B *b)
53{
54  b->mwibble ();                    // can be inlined
55  void (B::*ptr) () = &B::mwobble;  // force out of line issue
56
57  bar (ptr);                        // make sure we make use of it
58}
59
60struct C
61{
62  virtual void vwobble ()
63  {};                               // { dg-bogus "" } cannot inline
64};
65
66void bar4 ()
67{
68  C c;                              // force issue of C's vtable etc
69}
70