[Bug libstdc++/62187] std::string==const char* could compare sizes first

redi at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Tue Jun 14 14:58:25 GMT 2022


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

           What    |Removed                     |Added
           Assignee|unassigned at gcc dot gnu.org      |redi at gcc dot gnu.org
             Status|NEW                         |ASSIGNED

--- Comment #7 from Jonathan Wakely <redi at gcc dot gnu.org> ---
(In reply to Jonathan Wakely from comment #5)
> I've also created an LWG issue about this,

Rather than a new issue, this was added to https://wg21.link/lwg2852 

The resolution was to confirm that operator== doesn't need to call compare if
it can determine the result another way. That means we can do the length check

More information about the Gcc-bugs mailing list