2018-06-21 Jonathan Wakely <jwakely@redhat.com>
+ PR libstdc++/83328
+ * acinclude.m4 (libtool_VERSION): Bump to 6:26:0.
+ * config/abi/pre/gnu.ver: Add GLIBCXX_3.4.26 and export new symbol.
+ * configure: Regenerate.
+ * include/bits/basic_string.h [_GLIBCXX_USE_CXX11_ABI]
+ (basic_string::insert(const_iterator, initializer_list<C>)): Add.
+ [_GLIBCXX_USE_CXX11_ABI && !_GLIBCXX_DEFINING_STRING_INSTANTIATIONS]
+ (basic_string::insert(iterator, initializer_list<C>)): Suppress
+ definition.
+ * include/debug/string (basic_string::insert(iterator, C)): Change
+ first parameter to const_iterator.
+ (basic_string::insert(iterator, size_type, C)): Likewise. Change
+ return type to iterator.
+ (basic_string::insert(iterator, InputIterator, InputIterator)):
+ Likewise.
+ (basic_string::insert(iterator, initializer_list<C>)): Change first
+ parameter to const_iterator and return type to iterator.
+ * src/c++11/string-inst.cc: Extend comment.
+ * testsuite/21_strings/basic_string/modifiers/insert/char/83328.cc:
+ New.
+ * testsuite/21_strings/basic_string/modifiers/insert/wchar_t/83328.cc:
+ New.
+ * testsuite/util/testsuite_abi.cc: Add new symbol version.
+
* config/abi/post/x86_64-linux-gnu/baseline_symbols.txt: Update.
PR libstdc++/70940
fi
# For libtool versioning info, format is CURRENT:REVISION:AGE
-libtool_VERSION=6:25:0
+libtool_VERSION=6:26:0
# Everything parsed; figure out what files and settings to use.
case $enable_symvers in
_ZNSt7__cxx1112basic_stringI[cw]St11char_traitsI[cw]ESaI[cw]EE13*;
_ZNSt7__cxx1112basic_stringI[cw]St11char_traitsI[cw]ESaI[cw]EE14_M_replace_aux*;
_ZNSt7__cxx1112basic_stringI[cw]St11char_traitsI[cw]ESaI[cw]EE1[5-9]*;
- _ZNSt7__cxx1112basic_stringI[cw]St11char_traitsI[cw]ESaI[cw]EE[2-9]*;
+ _ZNSt7__cxx1112basic_stringI[cw]St11char_traitsI[cw]ESaI[cw]EE2at*;
+ _ZNSt7__cxx1112basic_stringI[cw]St11char_traitsI[cw]ESaI[cw]EE3end*;
+ _ZNSt7__cxx1112basic_stringI[cw]St11char_traitsI[cw]ESaI[cw]EE4back*;
+ _ZNSt7__cxx1112basic_stringI[cw]St11char_traitsI[cw]ESaI[cw]EE4nposE;
+ _ZNSt7__cxx1112basic_stringI[cw]St11char_traitsI[cw]ESaI[cw]EE4rend*;
+ _ZNSt7__cxx1112basic_stringI[cw]St11char_traitsI[cw]ESaI[cw]EE4swap*;
+ _ZNSt7__cxx1112basic_stringI[cw]St11char_traitsI[cw]ESaI[cw]EE5begin*;
+ _ZNSt7__cxx1112basic_stringI[cw]St11char_traitsI[cw]ESaI[cw]EE5clear*;
+ _ZNSt7__cxx1112basic_stringI[cw]St11char_traitsI[cw]ESaI[cw]EE5erase*;
+ _ZNSt7__cxx1112basic_stringI[cw]St11char_traitsI[cw]ESaI[cw]EE5front*;
+ _ZNSt7__cxx1112basic_stringI[cw]St11char_traitsI[cw]ESaI[cw]EE6append*;
+ _ZNSt7__cxx1112basic_stringI[cw]St11char_traitsI[cw]ESaI[cw]EE6assign*;
+ _ZNSt7__cxx1112basic_stringI[cw]St11char_traitsI[cw]ESaI[cw]EE6insertI*;
+ _ZNSt7__cxx1112basic_stringI[cw]St11char_traitsI[cw]ESaI[cw]EE6insertEmPK[cw];
+ _ZNSt7__cxx1112basic_stringI[cw]St11char_traitsI[cw]ESaI[cw]EE6insertEmPK[cw]m;
+ _ZNSt7__cxx1112basic_stringI[cw]St11char_traitsI[cw]ESaI[cw]EE6insertEmRKS4_;
+ _ZNSt7__cxx1112basic_stringI[cw]St11char_traitsI[cw]ESaI[cw]EE6insertEmRKS4_mm;
+ _ZNSt7__cxx1112basic_stringI[cw]St11char_traitsI[cw]ESaI[cw]EE6insertEmm[cw];
+ _ZNSt7__cxx1112basic_stringI[cw]St11char_traitsI[cw]ESaI[cw]EE6insertEN9__gnu_cxx17__normal_iteratorIP[cw]*;
+ _ZNSt7__cxx1112basic_stringI[cw]St11char_traitsI[cw]ESaI[cw]EE6insertEN9__gnu_cxx17__normal_iteratorIPK[cw]S4_EE[cw];
+ _ZNSt7__cxx1112basic_stringI[cw]St11char_traitsI[cw]ESaI[cw]EE6insertEN9__gnu_cxx17__normal_iteratorIPK[cw]S4_EEm[cw];
+ _ZNSt7__cxx1112basic_stringI[cw]St11char_traitsI[cw]ESaI[cw]EE6rbegin*;
+ _ZNSt7__cxx1112basic_stringI[cw]St11char_traitsI[cw]ESaI[cw]EE6resize*;
+ _ZNSt7__cxx1112basic_stringI[cw]St11char_traitsI[cw]ESaI[cw]EE7replace*;
+ _ZNSt7__cxx1112basic_stringI[cw]St11char_traitsI[cw]ESaI[cw]EE7reserve*;
+ _ZNSt7__cxx1112basic_stringI[cw]St11char_traitsI[cw]ESaI[cw]EE8pop_back*;
+ _ZNSt7__cxx1112basic_stringI[cw]St11char_traitsI[cw]ESaI[cw]EE9push_back*;
+ _ZNSt7__cxx1112basic_stringI[cw]St11char_traitsI[cw]ESaI[cw]EE[7-9]_[MS]_*;
_ZNSt7__cxx1112basic_stringI[cw]St11char_traitsI[cw]ESaI[cw]EEC[12]EOS4_*;
_ZNSt7__cxx1112basic_stringI[cw]St11char_traitsI[cw]ESaI[cw]EEC[12]EPK*;
_ZNSt7__cxx1112basic_stringI[cw]St11char_traitsI[cw]ESaI[cw]EEC[12]ERKS[34]_;
} GLIBCXX_3.4.24;
+GLIBCXX_3.4.26 {
+
+ # std::basic_string::insert(const_iterator, initializer_list)
+ _ZNSt7__cxx1112basic_stringI[cw]St11char_traitsI[cw]ESaI[cw]EE6insertEN9__gnu_cxx17__normal_iteratorIPK[cw]S4_EESt16initializer_listI[cw]E;
+
+} GLIBCXX_3.4.25;
+
# Symbols in the support library (libsupc++) have their own tag.
CXXABI_1.3 {
fi
# For libtool versioning info, format is CURRENT:REVISION:AGE
-libtool_VERSION=6:25:0
+libtool_VERSION=6:26:0
# Everything parsed; figure out what files and settings to use.
case $enable_symvers in
* @param __l The initializer_list of characters to insert.
* @throw std::length_error If new length exceeds @c max_size().
*/
+ iterator
+ insert(const_iterator __p, initializer_list<_CharT> __l)
+ { return this->insert(__p, __l.begin(), __l.end()); }
+
+#ifdef _GLIBCXX_DEFINING_STRING_INSTANTIATIONS
+ // See PR libstdc++/83328
void
insert(iterator __p, initializer_list<_CharT> __l)
{
_GLIBCXX_DEBUG_PEDASSERT(__p >= begin() && __p <= end());
this->insert(__p - begin(), __l.begin(), __l.size());
}
+#endif
#endif // C++11
/**
}
iterator
- insert(iterator __p, _CharT __c)
+ insert(const_iterator __p, _CharT __c)
{
__glibcxx_check_insert(__p);
typename _Base::iterator __res = _Base::insert(__p.base(), __c);
return iterator(__res, this);
}
- void
- insert(iterator __p, size_type __n, _CharT __c)
+ iterator
+ insert(const_iterator __p, size_type __n, _CharT __c)
{
__glibcxx_check_insert(__p);
- _Base::insert(__p.base(), __n, __c);
+ typename _Base::iterator __res = _Base::insert(__p.base(), __n, __c);
this->_M_invalidate_all();
+ return iterator(__res, this);
}
template<typename _InputIterator>
- void
- insert(iterator __p, _InputIterator __first, _InputIterator __last)
+ iterator
+ insert(const_iterator __p, _InputIterator __first, _InputIterator __last)
{
typename __gnu_debug::_Distance_traits<_InputIterator>::__type __dist;
__glibcxx_check_insert_range2(__p, __first, __last, __dist);
+ typename _Base::iterator __res;
if (__dist.second >= __dp_sign)
- _Base::insert(__p.base(), __gnu_debug::__unsafe(__first),
- __gnu_debug::__unsafe(__last));
+ __res = _Base::insert(__p.base(), __gnu_debug::__unsafe(__first),
+ __gnu_debug::__unsafe(__last));
else
- _Base::insert(__p.base(), __first, __last);
-
+ __res = _Base::insert(__p.base(), __first, __last);
this->_M_invalidate_all();
+ return iterator(__res, this);
}
#if __cplusplus >= 201103L
- void
- insert(iterator __p, std::initializer_list<_CharT> __l)
+ iterator
+ insert(const_iterator __p, std::initializer_list<_CharT> __l)
{
__glibcxx_check_insert(__p);
- _Base::insert(__p.base(), __l);
+ const auto __res = _Base::insert(__p.base(), __l);
this->_M_invalidate_all();
+ return iterator(__res, this);
}
#endif // C++11
// basic_string(size_type, _CharT, const _Alloc&) constructors from being
// replaced by constrained function templates, so that we instantiate the
// pre-C++17 definitions.
+// This also causes the instantiation of the non-standard C++0x-era
+// insert(iterator, initializer_list<C>) overload, see PR libstdc++/83328
#define _GLIBCXX_DEFINING_STRING_INSTANTIATIONS 1
#include <string>
--- /dev/null
+// Copyright (C) 2018 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// { dg-do run { target c++11 } }
+// { dg-require-effective-target cxx11-abi }
+
+// PR libstdc++/83328
+
+#include <string>
+#include <testsuite_hooks.h>
+
+void
+test01()
+{
+ std::string s = "insert";
+ auto iter = s.insert(s.cbegin() + 2, std::initializer_list<char>{});
+ VERIFY( iter == s.begin() + 2 );
+
+ iter = s.insert(s.cend(), { 'e', 'd' });
+ std::string::iterator* check_type = &iter;
+ VERIFY( iter == s.cend() - 2 );
+ VERIFY( s == "inserted" );
+
+ iter = s.insert(s.begin() + 6, { ' ', 'r', 'e', 't', 'r', 'i' });
+ VERIFY( iter == s.begin() + 6 );
+ VERIFY( s == "insert retried" );
+}
+
+int main()
+{
+ test01();
+}
--- /dev/null
+// Copyright (C) 2018 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// { dg-do run { target c++11 } }
+// { dg-require-effective-target cxx11-abi }
+
+// PR libstdc++/83328
+
+#include <string>
+#include <testsuite_hooks.h>
+
+void
+test01()
+{
+ std::wstring s = L"insert";
+ auto iter = s.insert(s.cbegin() + 2, std::initializer_list<wchar_t>{});
+ VERIFY( iter == s.begin() + 2 );
+
+ iter = s.insert(s.cend(), { L'e', L'd' });
+ std::wstring::iterator* check_type = &iter;
+ VERIFY( iter == s.cend() - 2 );
+ VERIFY( s == L"inserted" );
+
+ iter = s.insert(s.begin() + 6, { L' ', L'r', L'e', L't', L'r', L'i' });
+ VERIFY( iter == s.begin() + 6 );
+ VERIFY( s == L"insert retried" );
+
+}
+
+int main()
+{
+ test01();
+}
known_versions.push_back("GLIBCXX_3.4.23");
known_versions.push_back("GLIBCXX_3.4.24");
known_versions.push_back("GLIBCXX_3.4.25");
+ known_versions.push_back("GLIBCXX_3.4.26");
known_versions.push_back("CXXABI_1.3");
known_versions.push_back("CXXABI_LDBL_1.3");
known_versions.push_back("CXXABI_1.3.1");
test.version_status = symbol::incompatible;
// Check that added symbols are added in the latest pre-release version.
- bool latestp = (test.version_name == "GLIBCXX_3.4.25"
+ bool latestp = (test.version_name == "GLIBCXX_3.4.26"
|| test.version_name == "CXXABI_1.3.11"
|| test.version_name == "CXXABI_FLOAT128"
|| test.version_name == "CXXABI_TM_1");