https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80893

--- Comment #3 from Jonathan Wakely <redi at gcc dot gnu.org> ---
This is actually a problem in vector<bool> though: it assumes allocate(0)
returns a non-null pointer, which is unspecified.

This should fix it:

--- a/libstdc++-v3/include/bits/stl_bvector.h
+++ b/libstdc++-v3/include/bits/stl_bvector.h
@@ -1091,7 +1091,7 @@ template<typename _Alloc>
     {
       _Bit_pointer __q = this->_M_allocate(__n);
       this->_M_impl._M_end_of_storage = __q + _S_nword(__n);
-      this->_M_impl._M_start = iterator(std::__addressof(*__q), 0);
+      this->_M_impl._M_start = iterator(__q ? std::__addressof(*__q) : 0, 0);
       this->_M_impl._M_finish = this->_M_impl._M_start + difference_type(__n);
     }

Reply via email to