| 1 |
/* { dg-options "-O2 -fdump-tree-einline-all" } */ |
| 2 |
class DocId { |
| 3 |
public: |
| 4 |
DocId() { } |
| 5 |
DocId(const DocId &other) { } |
| 6 |
}; |
| 7 |
|
| 8 |
int g; |
| 9 |
class Base { |
| 10 |
public: |
| 11 |
virtual void Foo(DocId id) { g++; } |
| 12 |
}; |
| 13 |
|
| 14 |
class Super: public Base { |
| 15 |
public: |
| 16 |
void Foo(DocId id) { } |
| 17 |
void Bar(Base *base, DocId id) __attribute__((noinline)); |
| 18 |
}; |
| 19 |
|
| 20 |
void Super::Bar(Base *base, DocId id) { |
| 21 |
Super::Foo(id); // direct call is inlined |
| 22 |
base->Foo(id); // indirect call is marked do not inline |
| 23 |
} |
| 24 |
|
| 25 |
int main(void) |
| 26 |
{ |
| 27 |
Base bah; |
| 28 |
Super baz; |
| 29 |
DocId gid; |
| 30 |
|
| 31 |
baz.Bar(&baz, gid); |
| 32 |
return 0; |
| 33 |
} |
| 34 |
/* { dg-final-use { scan-tree-dump "Inlining .*Super::Foo" "einline" } } */ |
| 35 |
/* { dg-final-use { scan-tree-dump-not "mismatched arguments" "einline" } } */ |