view gcc/testsuite/g++.dg/opt/inline15.C @ 111:04ced10e8804

gcc 7
author kono
date Fri, 27 Oct 2017 22:46:09 +0900
parents
children 84e7813d76e9
line wrap: on
line source

// PR tree-optimization/40813
// { dg-do compile }
// { dg-options "-O -fcheck-new" }

typedef __SIZE_TYPE__ size_t;
typedef void *P;
struct A;
struct B
{
  void *b[5];
  A *foo () { return (A *) & b[0]; }
};
struct A
{
  void *operator new (size_t x, B &y) { return y.foo (); }
};
struct C : public A
{
  virtual int bar () { }
};
struct D : public C
{
  static B baz (unsigned *x) { B b; new (b) D (x); return b; }
  D (unsigned *x) { }
};
struct E
{
  B e;
  B fn (unsigned *a) { return D::baz (a); }
  E (P b, unsigned *a) : e (fn (a)) { }
};

static unsigned *
fn2 ()
{
}

void
test (P x)
{
  E (x, fn2 ());
}