https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94041

--- Comment #3 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
You were faster.
I came up with:
struct T { T (); ~T (); static int t; };
int T::t = 0;
struct A { A () noexcept; A (const T &) noexcept; const T *a; };
struct B { ~B (); };
struct Pair { A a; B b; };

T::T ()
{
  t++;
}

T::~T ()
{
  t--;
}

A::A () noexcept : a (nullptr)
{
}

A::A (const T &t) noexcept : a (&t)
{
}

B::~B ()
{
}

T
baz () noexcept
{
  return T ();
}

void
foo (const Pair &p) noexcept
{
  if (T::t == 0)
    __builtin_abort ();
}

void
bar (const Pair& p) noexcept
{
  foo ({A (baz ()), p.b});
}

int
main ()
{
  Pair p;
  bar (p);
}

Reply via email to