There's no need to check for self-assignment here, it would just add
extra code for an unlikely case. Add a comment saying so.
libstdc++-v3/ChangeLog:
PR libstdc++/100147
* include/bits/gslice.h (operator=): Add comment about lack of
self-assignment check.
inline gslice&
gslice::operator=(const gslice& __g)
{
+ // Safe for self-assignment. Checking for it would add overhead just to
+ // optimize a case that should never happen anyway.
if (__g._M_index)
__g._M_index->_M_increment_use();
if (_M_index && _M_index->_M_decrement_use() == 0)