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

--- Comment #2 from Jonathan Wakely <redi at gcc dot gnu.org> ---
Runtime test:

struct Temp { ~Temp(); };
struct A{ A(const Temp&) noexcept;  };
struct B{ ~B(); };
struct Pair{ A a; B b; };

Temp make_temp() noexcept;
void foo(const Pair&) noexcept;

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


bool gone;
Temp::~Temp() { gone = true; }
A::A(const Temp&) noexcept { }
B::~B() { }

Temp make_temp() noexcept { return {}; }
void foo(const Pair&) noexcept { if (gone) __builtin_abort(); }

int main()
{
  Pair p{ Temp{}, {} };
  gone = false;
  bar(p);
}

Reply via email to