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

Jonathan Wakely <redi at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Last reconfirmed|2021-12-06 00:00:00         |2022-7-6

--- Comment #5 from Jonathan Wakely <redi at gcc dot gnu.org> ---
This affects the Debug Mode checks in std::array's operator== as reported in PR
106212:

namespace std
{
  struct array
  {
    constexpr const void* data() const { return this; }

    constexpr bool operator==(const array&) const
    {
      if (data() == nullptr)
        throw 1;
      return true;
    }
  };
}

struct P {
  bool operator==(P const &) const = default;
  std::array e;
};

void f() {
  static_assert(P() == P());
}

  static_assert(P() == P());



namespace std
{
  struct array
  {
    constexpr const void* data() const { return this; }

    constexpr bool operator==(const array&) const
    {
      if (data() == nullptr)
        throw 1;
      return true;
    }
  };
}

struct P {
  bool operator==(P const &) const = default;
  std::array e;
};

void f() {
  static_assert(P() == P()); // OK
}

  static_assert(P() == P()); // NOT OK

Reply via email to