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

            Bug ID: 106611
           Summary: std::is_nothrow_copy_constructible returns wrong
                    result
           Product: gcc
           Version: 12.1.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: libstdc++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: nikolasklauser at berlin dot de
  Target Milestone: ---

'std::nothrow_copy_constructible' returns the wrong result with a defaulted
copy constructor makred `noexcept(false)`.

Reproducer: (Godbolt: https://godbolt.org/z/3qdf87vd3)

#include <type_traits>

struct CopyConstructible {
  constexpr CopyConstructible() = default;
  constexpr explicit CopyConstructible(int x) : value(x) {}
  CopyConstructible(CopyConstructible const&) noexcept(false) = default;
  CopyConstructible& operator=(CopyConstructible const&) = delete;

  int value = -1;
};

static_assert(!std::is_nothrow_copy_constructible_v<CopyConstructible>); //
static assert fails

Reply via email to