From c980d0b4b7be9c8fe2da6d3bdd189dc0c3e61b49 Mon Sep 17 00:00:00 2001 From: Jonathan Wakely Date: Fri, 2 Oct 2015 23:13:18 +0100 Subject: [PATCH] Fix tests that fail with old std::string * testsuite/21_strings/basic_string/allocator/char/minimal.cc: Guard explicit instantiation with check for new ABI. * testsuite/21_strings/basic_string/allocator/wchar_t/minimal.cc: Likewise. Use wchar_t as char_type. From-SVN: r228435 --- libstdc++-v3/ChangeLog | 5 +++++ .../21_strings/basic_string/allocator/char/minimal.cc | 8 +++++--- .../21_strings/basic_string/allocator/wchar_t/minimal.cc | 9 +++++---- 3 files changed, 15 insertions(+), 7 deletions(-) diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index 9633f61a21e..64841c9868c 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,5 +1,10 @@ 2015-10-02 Jonathan Wakely + * testsuite/21_strings/basic_string/allocator/char/minimal.cc: Guard + explicit instantiation with check for new ABI. + * testsuite/21_strings/basic_string/allocator/wchar_t/minimal.cc: + Likewise. Use wchar_t as char_type. + * include/bits/basic_string.h [!_GLIBCXX_USE_CXX11_ABI] (basic_string::front() const, basic_string::back() const): Use noexcept instead of _GLIBCXX_NOEXCEPT macro. diff --git a/libstdc++-v3/testsuite/21_strings/basic_string/allocator/char/minimal.cc b/libstdc++-v3/testsuite/21_strings/basic_string/allocator/char/minimal.cc index 4bfd4cabe42..d8dbb002977 100644 --- a/libstdc++-v3/testsuite/21_strings/basic_string/allocator/char/minimal.cc +++ b/libstdc++-v3/testsuite/21_strings/basic_string/allocator/char/minimal.cc @@ -22,25 +22,27 @@ #include #include +#if _GLIBCXX_USE_CXX11_ABI using C = char; const C c = 'a'; using traits = std::char_traits; using __gnu_test::SimpleAllocator; -template class std::basic_string>; +template class std::basic_string>; void test01() { -#if _GLIBCXX_USE_CXX11_ABI typedef SimpleAllocator alloc_type; typedef std::allocator_traits traits_type; typedef std::basic_string test_type; test_type v(alloc_type{}); v.assign(1, c); v.assign(100, c); -#endif } +#else +void test01() { } +#endif int main() { diff --git a/libstdc++-v3/testsuite/21_strings/basic_string/allocator/wchar_t/minimal.cc b/libstdc++-v3/testsuite/21_strings/basic_string/allocator/wchar_t/minimal.cc index bfba87cc76b..713e0302ef6 100644 --- a/libstdc++-v3/testsuite/21_strings/basic_string/allocator/wchar_t/minimal.cc +++ b/libstdc++-v3/testsuite/21_strings/basic_string/allocator/wchar_t/minimal.cc @@ -22,7 +22,8 @@ #include #include -using C = char; +#if _GLIBCXX_USE_CXX11_ABI && defined(_GLIBCXX_USE_WCHAR_T) +using C = wchar_t; const C c = 'a'; using traits = std::char_traits; @@ -32,18 +33,18 @@ template class std::basic_string>; void test01() { -#if _GLIBCXX_USE_CXX11_ABI && defined(_GLIBCXX_USE_WCHAR_T) typedef SimpleAllocator alloc_type; typedef std::allocator_traits traits_type; typedef std::basic_string test_type; test_type v(alloc_type{}); v.assign(1, c); v.assign(100, c); -#endif } +#else +void test01() { } +#endif int main() { test01(); - return 0; } -- 2.30.2