| 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 <[email protected]> |
| 6 |
|
| 7 |
// derived from a bug report by Benjamin Kosnik <[email protected]> |
| 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 |
|
| 13 |
inline void wibble () |
| 14 |
{} |
| 15 |
|
| 16 |
inline void wobble () |
| 17 |
{} // { dg-bogus "" } cannot inline |
| 18 |
|
| 19 |
void bar (void (*)()); |
| 20 |
|
| 21 |
void 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 |
|
| 29 |
struct 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 |
|
| 42 |
void bar (void (B::*)()); |
| 43 |
|
| 44 |
void 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 |
|
| 52 |
void 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 |
|
| 60 |
struct C |
| 61 |
{ |
| 62 |
virtual void vwobble () |
| 63 |
{} // { dg-bogus "" } cannot inline |
| 64 |
}; |
| 65 |
|
| 66 |
void bar4 () |
| 67 |
{ |
| 68 |
C c; // force issue of C's vtable etc |
| 69 |
} |