aboutsummaryrefslogtreecommitdiffstats
path: root/gcc-4.9/gcc/testsuite/g++.dg/ipa/devirt-31.C
blob: 64c44ba1e9eee48f7f70a71f82158ab7d0751016 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
/* { dg-options "-O2 -std=c++11 -fdump-ipa-inline"  } */
#include <new>

class EmbeddedObject {
public:
  virtual int val() { return 2; }
};

class Container {
  alignas(EmbeddedObject) char buffer[sizeof(EmbeddedObject)];
public:
  EmbeddedObject *obj() { return (EmbeddedObject*)buffer; }
  Container() { new (buffer) EmbeddedObject(); }
};

Container o;

int main()
{
  __builtin_printf("%d\n", o.obj()->val());
}
/* { dg-final { scan-ipa-dump-not "__builtin_unreachable"  "inline"  } } */
/* { dg-final { cleanup-ipa-dump "inline" } } */