view gcc/testsuite/g++.dg/cpp0x/initlist116.C @ 145:1830386684a0

gcc-9.2.0
author anatofuz
date Thu, 13 Feb 2020 11:34:05 +0900
parents
children
line wrap: on
line source

// PR c++/66139
// { dg-do run { target c++11 } }

int constructed = 0;

class lock_guard_ext{
public:
  lock_guard_ext() { ++constructed; }
  ~lock_guard_ext() { --constructed; }
};
 
struct Access {
  lock_guard_ext lock;
  int value;
};
 
int t() {
  throw 0;
}

Access foo1() {
  return { {}, t() };
}
 
int main () {
  try { foo1(); } catch (int) {}
  if (constructed != 0)
    __builtin_abort();
}