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

--- Comment #3 from Tomasz KamiƄski <tomaszkam at gmail dot com> ---
> I don't see this as prohibiting the transformation.  The standard seems to be 
> saying that they might or might not compare as equal, which presumably 
> depends on how variables are laid out in memory.  The optimization seems 
> wrong to me.

But, the code snippet is not using == on this pointer, but std::less
specialization that is required to form total order, but in the attached
scenario as not because for p and b nor of following hold:
1) r(p, b)
2) r(b, p)
3) b is same as p (!r(p, b) && !r(b, p))
Which proves that r is not an total order. So the guarantee on the less<T*> is
no longer provided.

Reply via email to