https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88453
Bug ID: 88453
Summary: GCC pretends that constexpr default-constructible type
is nothrow constructible
Product: gcc
Version: unknown
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: ldionne.2 at gmail dot com
Target Milestone: ---
The following code does not compile with GCC trunk:
------------------------------------------------------------
#include <type_traits>
struct Throwing {
constexpr Throwing() {}
};
static_assert(!std::is_nothrow_default_constructible<Throwing>::value, "");
------------------------------------------------------------
It seems like GCC assumes that the default constructor is noexcept since it is
constexpr. Clang does not have this behaviour, and I believe Clang to be
correct in this case.
Live example: https://wandbox.org/permlink/1z1qYQSUDWsYJda1