https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83328
Marek Polacek <mpolacek at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |mpolacek at gcc dot gnu.org
--- Comment #1 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
Sounds like this could fix it but I haven't even tried to compile it:
--- a/libstdc++-v3/include/bits/basic_string.h
+++ b/libstdc++-v3/include/bits/basic_string.h
@@ -1586,13 +1586,16 @@ _GLIBCXX_BEGIN_NAMESPACE_CXX11
* @brief Insert an initializer_list of characters.
* @param __p Iterator referencing location in string to insert at.
* @param __l The initializer_list of characters to insert.
+ * @return Iterator referencing the first inserted char.
* @throw std::length_error If new length exceeds @c max_size().
*/
- void
+ iterator
insert(iterator __p, initializer_list<_CharT> __l)
{
_GLIBCXX_DEBUG_PEDASSERT(__p >= begin() && __p <= end());
- this->insert(__p - begin(), __l.begin(), __l.size());
+ const size_type __pos = __p - begin();
+ this->insert(__pos, __l.begin(), __l.size());
+ return iterator(this->_M_data() + __pos);
}
#endif // C++11