This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c++/57645] New: Explicitly-declared destructor with no exception specification is always noexcept(true)


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57645

            Bug ID: 57645
           Summary: Explicitly-declared destructor with no exception
                    specification is always noexcept(true)
           Product: gcc
           Version: 4.8.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: travis at gockelhut dot com

#include <type_traits>

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

struct Explicit
{
    ~Explicit() {}

    Thrower t;
};
static_assert(!std::is_nothrow_destructible<Explicit>::value, "Explicit");


This will fail on the static_assert in 4.8, in contrast to Â15.4.14:

> ..If f is an...destructor...it's implicit exception-specification specifies...f has the exception-specification noexcept(true) if every function it directly invokes allows no exceptions.

And Thrower::~Thrower is directly invoked according to Â12.4.8:

> After executing the body of the destructor and destroying any automatic objects allocated within the body, a destructor for class X calls the destructors for Xâs direct non-variant non-static data members...

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]