(root)/
gcc-13.2.0/
gcc/
testsuite/
g++.dg/
cpp0x/
initlist90.C
// PR c++/57510
// { dg-do run { target c++11 } }

#include <initializer_list>

struct counter
{
  static int n;

  counter() { ++n; }
  counter(const counter&) { ++n; }
  ~counter() { --n; }
};

int counter::n = 0;

struct X
{
    X () { if (counter::n > 1) throw 1; }

    counter c;
};

int main ()
{
  try
  {
    auto x = { X{}, X{} };
  }
  catch (...)
  {
    if ( counter::n != 0 )
      throw;
  }
}