https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86537
Bug ID: 86537 Summary: std::less specialization for std::shared_ptr Product: gcc Version: 4.8.5 Status: UNCONFIRMED Severity: normal Priority: P3 Component: libstdc++ Assignee: unassigned at gcc dot gnu.org Reporter: d at ilvokhin dot com Target Milestone: --- Created attachment 44401 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=44401&action=edit problem demonstration There is a specialization for std::less for std::shared_ptr in bits/shared_ptr.h. I'm not sure it is really should be there. If user defines operator < for std::shared_ptr<user_type> some inconsistent behaviour may occurs depending on is operator < uses directly or through std::less. There is a reference to 20.8.13.2.7 in this header file, but I can't found nothing about std::less specialization for std::shared_ptr in standart. I attach a simple example.cpp file, which illustrates problem. (I use pretty old gcc version, but this behaviour persist in most recent versions as well)