view gcc/testsuite/g++.dg/cpp0x/implicit13.C @ 131:84e7813d76e9

gcc-8.2
author mir3636
date Thu, 25 Oct 2018 07:37:49 +0900
parents 04ced10e8804
children
line wrap: on
line source

// Make sure that A's destructor doesn't affect constexpr
// or exception-spec on D's default constructor.
// { dg-do compile { target c++11 } }

struct A {
  constexpr A() noexcept: i(0) { }
  int i;
  ~A() noexcept(false);
};

struct B: A { };

// Should get static initialization, so no constructor call.
// { dg-final { scan-assembler-not "_ZN1BC1Ev" } }
B b;

struct C { C() noexcept; ~C() noexcept(false); };
struct D: C { };
extern D d;

void *operator new(__SIZE_TYPE__, void*) noexcept;

#define SA(X) static_assert((X),#X)
SA(noexcept(new (&d) D));

struct E: virtual C { };
extern E e;
SA(noexcept (new (&e) E));

struct F { C c; };
extern F f;
SA(noexcept (new (&f) F));