view gcc/testsuite/g++.dg/opt/pr71387.C @ 131:84e7813d76e9

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

// PR middle-end/71387
// { dg-do compile }
// { dg-options "-Og" }

struct A
{
  A ();
  inline A (const A &);
};

struct B
{
  explicit B (unsigned long) : b(0), c(1) {}
  A a;
  unsigned long b;
  int c;
};

struct C {};

struct D
{
  explicit D (const C *) {}
};

struct E : public D
{
  E (const C *x) : D(x) {}
  virtual A foo () const = 0;
  virtual A bar () const = 0;
};

struct F : public B
{
  inline void baz ();
  F (const E *);
  const E *f;
};

inline void
F::baz ()
{
  if (b == 0)
    a = f->bar ();
  else
    a = f->foo ();
}

F::F (const E *) : B(4)
{
  baz ();
}