| 1 |
// Make sure that A's destructor doesn't affect constexpr |
| 2 |
// or exception-spec on D's default constructor. |
| 3 |
// { dg-do compile { target c++11 } } |
| 4 |
|
| 5 |
struct A { |
| 6 |
constexpr A() noexcept: i(0) { } |
| 7 |
int i; |
| 8 |
~A() noexcept(false); |
| 9 |
}; |
| 10 |
|
| 11 |
struct B: A { }; |
| 12 |
|
| 13 |
// Should get static initialization, so no constructor call. |
| 14 |
// { dg-final { scan-assembler-not "_ZN1BC1Ev" } } |
| 15 |
B b; |
| 16 |
|
| 17 |
struct C { C() noexcept; ~C() noexcept(false); }; |
| 18 |
struct D: C { }; |
| 19 |
extern D d; |
| 20 |
|
| 21 |
void *operator new(__SIZE_TYPE__, void*) noexcept; |
| 22 |
|
| 23 |
#define SA(X) static_assert((X),#X) |
| 24 |
SA(noexcept(new (&d) D)); |
| 25 |
|
| 26 |
struct E: virtual C { }; |
| 27 |
extern E e; |
| 28 |
SA(noexcept (new (&e) E)); |
| 29 |
|
| 30 |
struct F { C c; }; |
| 31 |
extern F f; |
| 32 |
SA(noexcept (new (&f) F)); |