Message ID | 20240208214932.2737795-1-jwakely@redhat.com |
---|---|
State | New |
Headers | show |
Series | [committed] libstdc++: Add comment to gslice::operator=(const gslice&) [PR100147] | expand |
diff --git a/libstdc++-v3/include/bits/gslice.h b/libstdc++-v3/include/bits/gslice.h index 3d78da2bd75..d9a8b929a57 100644 --- a/libstdc++-v3/include/bits/gslice.h +++ b/libstdc++-v3/include/bits/gslice.h @@ -169,6 +169,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION 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)