mirror of git://gcc.gnu.org/git/gcc.git
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
This commit is contained in:
parent
783aa06e9b
commit
c980d0b4b7
|
|
@ -1,5 +1,10 @@
|
||||||
2015-10-02 Jonathan Wakely <jwakely@redhat.com>
|
2015-10-02 Jonathan Wakely <jwakely@redhat.com>
|
||||||
|
|
||||||
|
* 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]
|
* include/bits/basic_string.h [!_GLIBCXX_USE_CXX11_ABI]
|
||||||
(basic_string::front() const, basic_string::back() const): Use
|
(basic_string::front() const, basic_string::back() const): Use
|
||||||
noexcept instead of _GLIBCXX_NOEXCEPT macro.
|
noexcept instead of _GLIBCXX_NOEXCEPT macro.
|
||||||
|
|
|
||||||
|
|
@ -22,6 +22,7 @@
|
||||||
#include <testsuite_hooks.h>
|
#include <testsuite_hooks.h>
|
||||||
#include <testsuite_allocator.h>
|
#include <testsuite_allocator.h>
|
||||||
|
|
||||||
|
#if _GLIBCXX_USE_CXX11_ABI
|
||||||
using C = char;
|
using C = char;
|
||||||
const C c = 'a';
|
const C c = 'a';
|
||||||
using traits = std::char_traits<C>;
|
using traits = std::char_traits<C>;
|
||||||
|
|
@ -32,15 +33,16 @@ template class std::basic_string<C,traits, SimpleAllocator<C>>;
|
||||||
|
|
||||||
void test01()
|
void test01()
|
||||||
{
|
{
|
||||||
#if _GLIBCXX_USE_CXX11_ABI
|
|
||||||
typedef SimpleAllocator<C> alloc_type;
|
typedef SimpleAllocator<C> alloc_type;
|
||||||
typedef std::allocator_traits<alloc_type> traits_type;
|
typedef std::allocator_traits<alloc_type> traits_type;
|
||||||
typedef std::basic_string<C, traits, alloc_type> test_type;
|
typedef std::basic_string<C, traits, alloc_type> test_type;
|
||||||
test_type v(alloc_type{});
|
test_type v(alloc_type{});
|
||||||
v.assign(1, c);
|
v.assign(1, c);
|
||||||
v.assign(100, c);
|
v.assign(100, c);
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
#else
|
||||||
|
void test01() { }
|
||||||
|
#endif
|
||||||
|
|
||||||
int main()
|
int main()
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -22,7 +22,8 @@
|
||||||
#include <testsuite_hooks.h>
|
#include <testsuite_hooks.h>
|
||||||
#include <testsuite_allocator.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';
|
const C c = 'a';
|
||||||
using traits = std::char_traits<C>;
|
using traits = std::char_traits<C>;
|
||||||
|
|
||||||
|
|
@ -32,18 +33,18 @@ template class std::basic_string<C,traits, SimpleAllocator<C>>;
|
||||||
|
|
||||||
void test01()
|
void test01()
|
||||||
{
|
{
|
||||||
#if _GLIBCXX_USE_CXX11_ABI && defined(_GLIBCXX_USE_WCHAR_T)
|
|
||||||
typedef SimpleAllocator<C> alloc_type;
|
typedef SimpleAllocator<C> alloc_type;
|
||||||
typedef std::allocator_traits<alloc_type> traits_type;
|
typedef std::allocator_traits<alloc_type> traits_type;
|
||||||
typedef std::basic_string<C, traits, alloc_type> test_type;
|
typedef std::basic_string<C, traits, alloc_type> test_type;
|
||||||
test_type v(alloc_type{});
|
test_type v(alloc_type{});
|
||||||
v.assign(1, c);
|
v.assign(1, c);
|
||||||
v.assign(100, c);
|
v.assign(100, c);
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
#else
|
||||||
|
void test01() { }
|
||||||
|
#endif
|
||||||
|
|
||||||
int main()
|
int main()
|
||||||
{
|
{
|
||||||
test01();
|
test01();
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue