Message ID | YVdkL3tQZXGpAfvT@redhat.com |
---|---|
State | New |
Headers | show |
Series | [committed] libstdc++: Do not allocate a zero-size vector<bool> [PR 100153] | expand |
diff --git a/libstdc++-v3/include/bits/vector.tcc b/libstdc++-v3/include/bits/vector.tcc index caee5cbfc2f..16366e03c86 100644 --- a/libstdc++-v3/include/bits/vector.tcc +++ b/libstdc++-v3/include/bits/vector.tcc @@ -944,7 +944,13 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER return false; __try { - _M_reallocate(size()); + if (size_type __n = size()) + _M_reallocate(__n); + else + { + this->_M_deallocate(); + this->_M_impl._M_reset(); + } return true; } __catch(...)