https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106802
Jonathan Wakely <redi at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Resolution|--- |INVALID
Status|UNCONFIRMED |RESOLVED
--- Comment #2 from Jonathan Wakely <redi at gcc dot gnu.org> ---
(In reply to Jonathan Wakely from comment #1)
> When the comparison happens inside std::less<>::operator() it's not being
> compared with a literal 0, it's an lvalue of type int by that point. That
> isn't required to work.
In fact, it isn't just not required to work, it's explicitly undefined. The
rest of p3 is:
"In this context, the behavior of a program that supplies an argument other
than a literal 0 is undefined."