http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54722
Bug #: 54722 Summary: std::is_nothrow_default_constructible<T>::value depends on whether destructor throws or not. Classification: Unclassified Product: gcc Version: unknown Status: UNCONFIRMED Severity: normal Priority: P3 Component: libstdc++ AssignedTo: unassig...@gcc.gnu.org ReportedBy: cassio.n...@gmail.com Consider: #include <iostream> #include <type_traits> struct foo { foo() noexcept {} ~foo() {} }; int main() { std::cout << std::boolalpha; std::cout << std::is_nothrow_default_constructible<foo>::value << std::endl; return 0; } This should output 'true' but it outputs 'false'. Adding a 'noexcept' specification to ~foo() makes the code to output the expected result. Looking at the source, I guess, the reason lies on the implementation of this helper class: template<typename _Tp> struct __is_nt_default_constructible_atom : public integral_constant<bool, noexcept(_Tp())> { }; Indeed, the expression '_Tp()' if executed creates a temporary of type _Tp whose lifetime ends immediately and ~Tp_ is called. Therefore, 'noexcept(_Tp())' is 'true' if and only if neither the constructor nor the destructor throw. I believe the below implementation fixes the problem (at least it does for the example above): template<typename _Tp> struct __is_nt_default_constructible_atom : public std::integral_constant<bool, noexcept(new (std::nothrow) _Tp)> { };