[Bug libstdc++/78420] [5/6/7 Regression] std::less<T*> is not a total order with -O2 enabled
jens.maurer at gmx dot net
gcc-bugzilla@gcc.gnu.org
Mon Jan 23 22:57:00 GMT 2017
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78420
--- Comment #18 from Jens Maurer <jens.maurer at gmx dot net> ---
Then you should cheat on [dcl.constexpr] p5 by carving out the nullptr case:
constexpr void less_than(int *p1, int *p2)
{
if (p1 == nullptr && p2 == nullptr)
return false;
return (size_t)p1 < (size_t)p2;
}
This should sidestep [dcl.constexpr] p5, since "less_than(0,0)" seems to be, in
fact, a constant expression.
More information about the Gcc-bugs
mailing list