view gcc/testsuite/g++.dg/cpp0x/noexcept21.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

// PR c++/57645
// { dg-do compile { target c++11 } }

struct Thrower
{
  ~Thrower() noexcept(false) { throw 1; }
};

struct ExplicitA
{
  ~ExplicitA() {}

  Thrower t;
};

struct ExplicitB
{
  ~ExplicitB();

  Thrower t;
};

ExplicitB::~ExplicitB() {}

struct ExplicitC
{
  ~ExplicitC() = default;

  Thrower t;
};

struct ExplicitD
{
  ~ExplicitD();

  Thrower t;
};

ExplicitD::~ExplicitD() = default;

struct NoThrower
{
  ~NoThrower() noexcept(true) {}
};

struct ExplicitE
{
  ~ExplicitE() {}

  NoThrower t;
};

struct ExplicitF
{
  ~ExplicitF();

  NoThrower t;
};

ExplicitF::~ExplicitF() {}

struct ExplicitG
{
  ~ExplicitG() = default;

  NoThrower t;
};

struct ExplicitH
{
  ~ExplicitH();

  NoThrower t;
};

ExplicitH::~ExplicitH() = default;

#define SA(X) static_assert(X, #X)

SA( !noexcept(ExplicitA()) );
SA( !noexcept(ExplicitB()) );
SA( !noexcept(ExplicitC()) );
SA( !noexcept(ExplicitD()) );
SA( noexcept(ExplicitE()) );
SA( noexcept(ExplicitF()) );
SA( noexcept(ExplicitG()) );
SA( noexcept(ExplicitH()) );