These tests only work with the new std::string, but the preprocessor test was in the wrong place.
Tested powerpc64le-linux, committed to trunk.
commit 482100af94e90eaa6fb3c865e30bc907f6691f59 Author: Jonathan Wakely <jwak...@redhat.com> Date: Fri Oct 2 23:16:27 2015 +0100 * testsuite/21_strings/basic_string/allocator/wchar_t/minimal.cc: Minor tweaks to match narrow char version. 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 713e030..b97a58a 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 @@ -24,12 +24,12 @@ #if _GLIBCXX_USE_CXX11_ABI && defined(_GLIBCXX_USE_WCHAR_T) using C = wchar_t; -const C c = 'a'; +const C c = L'a'; using traits = std::char_traits<C>; using __gnu_test::SimpleAllocator; -template class std::basic_string<C,traits, SimpleAllocator<C>>; +template class std::basic_string<C, traits, SimpleAllocator<C>>; void test01() { @@ -47,4 +47,5 @@ void test01() { } int main() { test01(); + return 0; } commit fb5507b27f560acd7f596e733286f21716cb1c25 Author: redi <redi@138bc75d-0d04-0410-961f-82ee72b054a4> Date: Fri Oct 2 22:13:18 2015 +0000 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. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@228435 138bc75d-0d04-0410-961f-82ee72b054a4 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 4bfd4ca..d8dbb00 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 <testsuite_hooks.h> #include <testsuite_allocator.h> +#if _GLIBCXX_USE_CXX11_ABI using C = char; const C c = 'a'; using traits = std::char_traits<C>; using __gnu_test::SimpleAllocator; -template class std::basic_string<C,traits, SimpleAllocator<C>>; +template class std::basic_string<C, traits, SimpleAllocator<C>>; void test01() { -#if _GLIBCXX_USE_CXX11_ABI typedef SimpleAllocator<C> alloc_type; typedef std::allocator_traits<alloc_type> traits_type; typedef std::basic_string<C, traits, alloc_type> 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 bfba87c..713e030 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 <testsuite_hooks.h> #include <testsuite_allocator.h> -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<C>; @@ -32,18 +33,18 @@ template class std::basic_string<C,traits, SimpleAllocator<C>>; void test01() { -#if _GLIBCXX_USE_CXX11_ABI && defined(_GLIBCXX_USE_WCHAR_T) typedef SimpleAllocator<C> alloc_type; typedef std::allocator_traits<alloc_type> traits_type; typedef std::basic_string<C, traits, alloc_type> 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; }