summaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.dg/tree-prof/inline_mismatch_args.C
blob: e82a46ebffd4bff9bb5aa03403776e13ad9dc49d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
/* { dg-options "-O2 -fdump-tree-einline" } */
class DocId {
 public:
 DocId() { }
 DocId(const DocId &other) {  }
};

int g;
class Base {
 public:
 virtual void Foo(DocId id) { g++; }
};

class Super: public Base {
 public:
 void Foo(DocId id) { }
 void Bar(Base *base, DocId id) __attribute__((noinline));
};

void Super::Bar(Base *base, DocId id) {
 Super::Foo(id); // direct call is inlined
 base->Foo(id); // indirect call is marked do not inline
}

int main(void)
{
 Base bah;
 Super baz;
 DocId gid;

 baz.Bar(&baz, gid);
 return 0;
}
/* { dg-final-use { scan-tree-dump "Inlining .*Super::Foo" "einline" } } */
/* { dg-final-use { scan-tree-dump-not "mismatched arguments" "einline" } } */
/* { dg-final-use { cleanup-tree-dump "einline" } } */