https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100470

            Bug ID: 100470
           Summary: std::is_nothrow_move_constructible incorrect behavior
                    for explicitly defaulted members
           Product: gcc
           Version: 11.1.0
               URL: https://godbolt.org/z/hqeh4E3M8
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: libstdc++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: oleksandr.koval.dev at gmail dot com
  Target Milestone: ---

Explicit exception specification should be the actual one, hence, S2 should NOT
be nothrow-constructible.

#include <type_traits>

struct S1{
    S1(S1&&) noexcept(false);
};
struct S2{
    S2(S2&&) noexcept(false) = default;
};
struct S3{
    S3(S3&&) noexcept(false){}
};
struct S4{
    S4(S4&&) = default;
};

static_assert(!std::is_nothrow_move_constructible_v<S1>);  // OK
static_assert(!std::is_nothrow_move_constructible_v<S2>);  // failed
static_assert(!std::is_nothrow_move_constructible_v<S3>);  // OK
static_assert(std::is_nothrow_move_constructible_v<S4>);   // OK

Reply via email to