view gcc/testsuite/g++.dg/tree-prof/inline_mismatch_args.C @ 131:84e7813d76e9

gcc-8.2
author mir3636
date Thu, 25 Oct 2018 07:37:49 +0900
parents 04ced10e8804
children 1830386684a0
line wrap: on
line source

/* { 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" } } */