[Bug c++/85944] Address of temporary bound to a function parameter at global scope not considered constexpr
redi at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Wed Jul 6 10:44:31 GMT 2022
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
More information about the Gcc-bugs
mailing list