Commit 59019b42 by Tom Honermann Committed by Jonathan Wakely

P0482R5 char8_t: Updates to existing standard library tests

This patch augments existing tests to validate behavior for char8_t.  In
all cases, added test cases are cloned from existing tests for wchar_t
or char16_t.

A few tests required updates to line numbers for diagnostic messages.

2019-02-22  Tom Honermann  <tom@honermann.net>

	* testsuite/18_support/byte/ops.cc: Validate
	std::to_integer<char8_t>, std::to_integer<char16_t>, and
	std::to_integer<char32_t>.
	* testsuite/18_support/numeric_limits/dr559.cc: Validate
	std::numeric_limits<char8_t>.
	* testsuite/18_support/numeric_limits/lowest.cc: Validate
	std::numeric_limits<char8_t>::lowest().
	* testsuite/18_support/numeric_limits/max_digits10.cc: Validate
	std::numeric_limits<char8_t>::max_digits10.
	* testsuite/18_support/type_info/fundamental.cc: Validate
	typeinfo for char8_t.
	* testsuite/20_util/from_chars/1_c++20_neg.cc: New test, validating
	std::from_chars with char8_t.
	* testsuite/20_util/hash/requirements/explicit_instantiation.cc:
	Validate explicit instantiation of std::hash<char8_t>.
	* testsuite/20_util/is_integral/value.cc: Validate
	std::is_integral<char8_t>.
	* testsuite/20_util/make_signed/requirements/typedefs-4.cc:
	Validate std::make_signed<char8_t>.
	* testsuite/21_strings/basic_string/cons/char/deduction.cc:
	Validate u8string construction from char8_t sources.
	* testsuite/21_strings/basic_string/types/pmr_typedefs.cc: Validate
	std::pmr::u8string.
	* testsuite/21_strings/basic_string_view/operations/compare/
	char/70483.cc: Validate substr operations on u8string_view.
	* testsuite/21_strings/basic_string_view/typedefs.cc: Validate that
	the u8string_view typedef is defined.
	* testsuite/21_strings/char_traits/requirements/
	constexpr_functions.cc: Validate char_traits<char8_t> constexpr
	member functions.
	* testsuite/21_strings/char_traits/requirements/
	constexpr_functions_c++17.cc: Validate char_traits<char8_t> C++17
	constexpr member functions.
	* testsuite/21_strings/headers/string/types_std_c++0x.cc: Validate
	that the u8string typedef is defined.
	* testsuite/22_locale/locale/cons/unicode.cc: Validate the presence
	of the std::codecvt<char16_t, char8_t, std::mbstate_t> and
	std::codecvt<char32_t, char8_t, std::mbstate_t> facets.
	* testsuite/29_atomics/atomic/cons/assign_neg.cc: Update line
	numbers.
	* testsuite/29_atomics/atomic/cons/copy_neg.cc: Likewise.
	* testsuite/29_atomics/atomic_integral/cons/assign_neg.cc:
	Likewise.
	* testsuite/29_atomics/atomic_integral/cons/copy_neg.cc: Likewise.
	* testsuite/29_atomics/atomic_integral/is_always_lock_free.cc:
	Validate std::atomic<char8_t>::is_always_lock_free
	* testsuite/29_atomics/atomic_integral/operators/bitwise_neg.cc:
	Update line numbers.
	* testsuite/29_atomics/atomic_integral/operators/decrement_neg.cc:
	Likewise.
	* testsuite/29_atomics/atomic_integral/operators/increment_neg.cc:
	Likewise.
	* testsuite/experimental/polymorphic_allocator/pmr_typedefs_string.cc:
	Validate std::experimental::pmr::u8string.
	* testsuite/experimental/string_view/typedefs.cc: Validate that the
	u8string_view typedef is defined.
	* testsuite/util/testsuite_common_types.h: Add char8_t, char16_t and
	char32_t to the typelists.

From-SVN: r269089
parent 65bbaf31
2019-02-22 Tom Honermann <tom@honermann.net> 2019-02-22 Tom Honermann <tom@honermann.net>
* testsuite/18_support/byte/ops.cc: Validate
std::to_integer<char8_t>, std::to_integer<char16_t>, and
std::to_integer<char32_t>.
* testsuite/18_support/numeric_limits/dr559.cc: Validate
std::numeric_limits<char8_t>.
* testsuite/18_support/numeric_limits/lowest.cc: Validate
std::numeric_limits<char8_t>::lowest().
* testsuite/18_support/numeric_limits/max_digits10.cc: Validate
std::numeric_limits<char8_t>::max_digits10.
* testsuite/18_support/type_info/fundamental.cc: Validate
typeinfo for char8_t.
* testsuite/20_util/from_chars/1_c++20_neg.cc: New test, validating
std::from_chars with char8_t.
* testsuite/20_util/hash/requirements/explicit_instantiation.cc:
Validate explicit instantiation of std::hash<char8_t>.
* testsuite/20_util/is_integral/value.cc: Validate
std::is_integral<char8_t>.
* testsuite/20_util/make_signed/requirements/typedefs-4.cc:
Validate std::make_signed<char8_t>.
* testsuite/21_strings/basic_string/cons/char/deduction.cc:
Validate u8string construction from char8_t sources.
* testsuite/21_strings/basic_string/types/pmr_typedefs.cc: Validate
std::pmr::u8string.
* testsuite/21_strings/basic_string_view/operations/compare/
char/70483.cc: Validate substr operations on u8string_view.
* testsuite/21_strings/basic_string_view/typedefs.cc: Validate that
the u8string_view typedef is defined.
* testsuite/21_strings/char_traits/requirements/
constexpr_functions.cc: Validate char_traits<char8_t> constexpr
member functions.
* testsuite/21_strings/char_traits/requirements/
constexpr_functions_c++17.cc: Validate char_traits<char8_t> C++17
constexpr member functions.
* testsuite/21_strings/headers/string/types_std_c++0x.cc: Validate
that the u8string typedef is defined.
* testsuite/22_locale/locale/cons/unicode.cc: Validate the presence
of the std::codecvt<char16_t, char8_t, std::mbstate_t> and
std::codecvt<char32_t, char8_t, std::mbstate_t> facets.
* testsuite/29_atomics/atomic/cons/assign_neg.cc: Update line
numbers.
* testsuite/29_atomics/atomic/cons/copy_neg.cc: Likewise.
* testsuite/29_atomics/atomic_integral/cons/assign_neg.cc:
Likewise.
* testsuite/29_atomics/atomic_integral/cons/copy_neg.cc: Likewise.
* testsuite/29_atomics/atomic_integral/is_always_lock_free.cc:
Validate std::atomic<char8_t>::is_always_lock_free
* testsuite/29_atomics/atomic_integral/operators/bitwise_neg.cc:
Update line numbers.
* testsuite/29_atomics/atomic_integral/operators/decrement_neg.cc:
Likewise.
* testsuite/29_atomics/atomic_integral/operators/increment_neg.cc:
Likewise.
* testsuite/experimental/polymorphic_allocator/pmr_typedefs_string.cc:
Validate std::experimental::pmr::u8string.
* testsuite/experimental/string_view/typedefs.cc: Validate that the
u8string_view typedef is defined.
* testsuite/util/testsuite_common_types.h: Add char8_t, char16_t and
char32_t to the typelists.
2019-02-22 Tom Honermann <tom@honermann.net>
* include/ext/typelist.h: Constrain a partial specialization of * include/ext/typelist.h: Constrain a partial specialization of
typelist::detail::append_ to only match chain<T1,T2>. typelist::detail::append_ to only match chain<T1,T2>.
......
...@@ -218,7 +218,15 @@ constexpr bool test_to_integer(unsigned char c) ...@@ -218,7 +218,15 @@ constexpr bool test_to_integer(unsigned char c)
static_assert( test_to_integer<int>(0) ); static_assert( test_to_integer<int>(0) );
static_assert( test_to_integer<int>(255) ); static_assert( test_to_integer<int>(255) );
static_assert( test_to_integer<signed char>(0) );
static_assert( test_to_integer<signed char>(255) ); static_assert( test_to_integer<signed char>(255) );
static_assert( test_to_integer<unsigned>(0) ); static_assert( test_to_integer<unsigned>(0) );
static_assert( test_to_integer<unsigned>(255) ); static_assert( test_to_integer<unsigned>(255) );
#ifdef _GLIBCXX_USE_CHAR8_T
static_assert( test_to_integer<char8_t>(0) );
static_assert( test_to_integer<char8_t>(255) );
#endif
static_assert( test_to_integer<char16_t>(0) );
static_assert( test_to_integer<char16_t>(255) );
static_assert( test_to_integer<char32_t>(0) );
static_assert( test_to_integer<char32_t>(255) );
...@@ -84,6 +84,9 @@ int main() ...@@ -84,6 +84,9 @@ int main()
do_test<signed char>(); do_test<signed char>();
do_test<unsigned char>(); do_test<unsigned char>();
do_test<wchar_t>(); do_test<wchar_t>();
#ifdef _GLIBCXX_USE_CHAR8_T
do_test<char8_t>();
#endif
do_test<char16_t>(); do_test<char16_t>();
do_test<char32_t>(); do_test<char32_t>();
do_test<short>(); do_test<short>();
......
...@@ -55,6 +55,9 @@ void test01() ...@@ -55,6 +55,9 @@ void test01()
#ifdef _GLIBCXX_USE_WCHAR_T #ifdef _GLIBCXX_USE_WCHAR_T
do_test<wchar_t>(); do_test<wchar_t>();
#endif #endif
#ifdef _GLIBCXX_USE_CHAR8_T
do_test<char8_t>();
#endif
do_test<char16_t>(); do_test<char16_t>();
do_test<char32_t>(); do_test<char32_t>();
......
...@@ -42,6 +42,9 @@ test01() ...@@ -42,6 +42,9 @@ test01()
VERIFY( std::numeric_limits<unsigned long>::max_digits10 == 0 ); VERIFY( std::numeric_limits<unsigned long>::max_digits10 == 0 );
VERIFY( std::numeric_limits<long long>::max_digits10 == 0 ); VERIFY( std::numeric_limits<long long>::max_digits10 == 0 );
VERIFY( std::numeric_limits<unsigned long long>::max_digits10 == 0 ); VERIFY( std::numeric_limits<unsigned long long>::max_digits10 == 0 );
#ifdef _GLIBCXX_USE_CHAR8_T
VERIFY( std::numeric_limits<char8_t>::max_digits10 == 0 );
#endif
VERIFY( std::numeric_limits<char16_t>::max_digits10 == 0 ); VERIFY( std::numeric_limits<char16_t>::max_digits10 == 0 );
VERIFY( std::numeric_limits<char32_t>::max_digits10 == 0 ); VERIFY( std::numeric_limits<char32_t>::max_digits10 == 0 );
......
...@@ -50,6 +50,9 @@ int main() ...@@ -50,6 +50,9 @@ int main()
gen_type_info<long long>(); gen_type_info<long long>();
gen_type_info<unsigned long long>(); gen_type_info<unsigned long long>();
gen_type_info<wchar_t>(); gen_type_info<wchar_t>();
#ifdef _GLIBCXX_USE_CHAR8_T
gen_type_info<char8_t>();
#endif
gen_type_info<char16_t>(); gen_type_info<char16_t>();
gen_type_info<char32_t>(); gen_type_info<char32_t>();
......
// Copyright (C) 2017-2019 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-options "-std=gnu++2a" }
// { dg-do compile { target c++2a } }
#include <charconv>
void
test01(const char* first, const char* last)
{
wchar_t wc;
std::from_chars(first, last, wc); // { dg-error "no matching" }
std::from_chars(first, last, wc, 10); // { dg-error "no matching" }
char8_t c8;
std::from_chars(first, last, c8); // { dg-error "no matching" }
std::from_chars(first, last, c8, 10); // { dg-error "no matching" }
char16_t c16;
std::from_chars(first, last, c16); // { dg-error "no matching" }
std::from_chars(first, last, c16, 10); // { dg-error "no matching" }
char32_t c32;
std::from_chars(first, last, c32); // { dg-error "no matching" }
std::from_chars(first, last, c32, 10); // { dg-error "no matching" }
}
...@@ -26,6 +26,9 @@ template class std::hash<bool>; ...@@ -26,6 +26,9 @@ template class std::hash<bool>;
template class std::hash<char>; template class std::hash<char>;
template class std::hash<signed char>; template class std::hash<signed char>;
template class std::hash<unsigned char>; template class std::hash<unsigned char>;
#ifdef _GLIBCXX_USE_CHAR8_T
template class std::hash<char8_t>;
#endif
template class std::hash<char16_t>; template class std::hash<char16_t>;
template class std::hash<char32_t>; template class std::hash<char32_t>;
template class std::hash<short>; template class std::hash<short>;
......
...@@ -35,6 +35,9 @@ void test01() ...@@ -35,6 +35,9 @@ void test01()
#ifdef _GLIBCXX_USE_WCHAR_T #ifdef _GLIBCXX_USE_WCHAR_T
static_assert(test_category<is_integral, wchar_t>(true), ""); static_assert(test_category<is_integral, wchar_t>(true), "");
#endif #endif
#ifdef _GLIBCXX_USE_CHAR8_T
static_assert(test_category<is_integral, char8_t>(true), "");
#endif
static_assert(test_category<is_integral, char16_t>(true), ""); static_assert(test_category<is_integral, char16_t>(true), "");
static_assert(test_category<is_integral, char32_t>(true), ""); static_assert(test_category<is_integral, char32_t>(true), "");
static_assert(test_category<is_integral, short>(true), ""); static_assert(test_category<is_integral, short>(true), "");
......
...@@ -27,5 +27,8 @@ using wchar_signed = make_signed<wchar_t>::type; ...@@ -27,5 +27,8 @@ using wchar_signed = make_signed<wchar_t>::type;
using wchar_unsigned = make_unsigned<wchar_t>::type; using wchar_unsigned = make_unsigned<wchar_t>::type;
static_assert( !is_same<wchar_signed, wchar_unsigned>::value, "wchar_t" ); static_assert( !is_same<wchar_signed, wchar_unsigned>::value, "wchar_t" );
#endif #endif
#ifdef _GLIBCXX_USE_CHAR8_T
static_assert( is_signed<make_signed<char8_t>::type>::value, "char8_t");
#endif
static_assert( is_signed<make_signed<char16_t>::type>::value, "char16_t"); static_assert( is_signed<make_signed<char16_t>::type>::value, "char16_t");
static_assert( is_signed<make_signed<char32_t>::type>::value, "char32_t"); static_assert( is_signed<make_signed<char32_t>::type>::value, "char32_t");
...@@ -123,6 +123,27 @@ test04() ...@@ -123,6 +123,27 @@ test04()
void void
test05() test05()
{ {
#ifdef _GLIBCXX_USE_CHAR8_T
char8_t a[1] = {};
input_iterator_seq<char8_t> seq(a);
std::basic_string s1(seq.begin(), seq.end());
check_type<std::u8string>(s1);
std::basic_string s2(seq.begin(), seq.end(), std::allocator<char8_t>());
check_type<std::u8string>(s2);
std::basic_string s3((char8_t)1, u8'a');
check_type<std::u8string>(s3);
std::basic_string s4((char8_t)1, u8'a', std::allocator<char8_t>());
check_type<std::u8string>(s4);
#endif
}
void
test06()
{
// LWG 3075 basic_string needs deduction guides from basic_string_view // LWG 3075 basic_string needs deduction guides from basic_string_view
std::string_view sv{"A View to a Kill"}; std::string_view sv{"A View to a Kill"};
const std::allocator<char> a; const std::allocator<char> a;
...@@ -141,7 +162,7 @@ test05() ...@@ -141,7 +162,7 @@ test05()
} }
void void
test06() test07()
{ {
// LWG 3076 basic_string CTAD ambiguity // LWG 3076 basic_string CTAD ambiguity
using namespace std; using namespace std;
......
...@@ -33,6 +33,11 @@ static_assert(std::is_same_v<std::pmr::basic_string<char, T>, ...@@ -33,6 +33,11 @@ static_assert(std::is_same_v<std::pmr::basic_string<char, T>,
static_assert(std::is_same_v<std::pmr::string, static_assert(std::is_same_v<std::pmr::string,
std::basic_string<char, std::char_traits<char>, std::basic_string<char, std::char_traits<char>,
std::pmr::polymorphic_allocator<char>>>); std::pmr::polymorphic_allocator<char>>>);
#ifdef _GLIBCXX_USE_CHAR8_T
static_assert(std::is_same_v<std::pmr::u8string,
std::basic_string<char8_t, std::char_traits<char8_t>,
std::pmr::polymorphic_allocator<char8_t>>>);
#endif
static_assert(std::is_same_v<std::pmr::u16string, static_assert(std::is_same_v<std::pmr::u16string,
std::basic_string<char16_t, std::char_traits<char16_t>, std::basic_string<char16_t, std::char_traits<char16_t>,
std::pmr::polymorphic_allocator<char16_t>>>); std::pmr::polymorphic_allocator<char16_t>>>);
......
...@@ -58,6 +58,25 @@ string_view get() ...@@ -58,6 +58,25 @@ string_view get()
static_assert( get() == get() ); static_assert( get() == get() );
#ifdef _GLIBCXX_USE_CHAR8_T
using std::u8string_view;
#else
using u8string_view = std::basic_string_view<char>;
#endif
constexpr
u8string_view get8()
{
u8string_view res = u8"x::";
u8string_view start_pattern = u8"x";
res = res.substr(res.find(start_pattern) + start_pattern.size());
res = res.substr(0, res.find_first_of(u8";]"));
res = res.substr(res.rfind(u8"::"));
return res;
}
static_assert( get8() == get8() );
using std::u16string_view; using std::u16string_view;
constexpr constexpr
......
...@@ -25,12 +25,15 @@ template<typename C, typename T> ...@@ -25,12 +25,15 @@ template<typename C, typename T>
using check2_t = std::string_view; using check2_t = std::string_view;
#ifdef _GLIBCXX_USE_CHAR8_T
using check3_t = std::u8string_view;
#endif
#ifdef _GLIBCXX_USE_C99_STDINT_TR1 #ifdef _GLIBCXX_USE_C99_STDINT_TR1
using check3_t = std::u16string_view; using check4_t = std::u16string_view;
using check4_t = std::u32string_view; using check5_t = std::u32string_view;
#endif #endif
#ifdef _GLIBCXX_USE_WCHAR_T #ifdef _GLIBCXX_USE_WCHAR_T
using check5_t = std::wstring_view; using check6_t = std::wstring_view;
#endif #endif
...@@ -67,6 +67,9 @@ int main() ...@@ -67,6 +67,9 @@ int main()
#ifdef _GLIBCXX_USE_WCHAR_T #ifdef _GLIBCXX_USE_WCHAR_T
test.operator()<std::char_traits<wchar_t>>(); test.operator()<std::char_traits<wchar_t>>();
#endif #endif
#ifdef _GLIBCXX_USE_CHAR8_T
test.operator()<std::char_traits<char8_t>>();
#endif
test.operator()<std::char_traits<char16_t>>(); test.operator()<std::char_traits<char16_t>>();
test.operator()<std::char_traits<char32_t>>(); test.operator()<std::char_traits<char32_t>>();
return 0; return 0;
......
...@@ -89,6 +89,12 @@ static_assert( test_compare<std::char_traits<wchar_t>>() ); ...@@ -89,6 +89,12 @@ static_assert( test_compare<std::char_traits<wchar_t>>() );
static_assert( test_length<std::char_traits<wchar_t>>() ); static_assert( test_length<std::char_traits<wchar_t>>() );
static_assert( test_find<std::char_traits<wchar_t>>() ); static_assert( test_find<std::char_traits<wchar_t>>() );
#endif #endif
#ifdef _GLIBCXX_USE_CHAR8_T
static_assert( test_assign<std::char_traits<char8_t>>() );
static_assert( test_compare<std::char_traits<char8_t>>() );
static_assert( test_length<std::char_traits<char8_t>>() );
static_assert( test_find<std::char_traits<char8_t>>() );
#endif
static_assert( test_assign<std::char_traits<char16_t>>() ); static_assert( test_assign<std::char_traits<char16_t>>() );
static_assert( test_compare<std::char_traits<char16_t>>() ); static_assert( test_compare<std::char_traits<char16_t>>() );
static_assert( test_length<std::char_traits<char16_t>>() ); static_assert( test_length<std::char_traits<char16_t>>() );
......
...@@ -21,6 +21,9 @@ ...@@ -21,6 +21,9 @@
namespace gnu namespace gnu
{ {
#ifdef _GLIBCXX_USE_CHAR8_T
typedef std::u8string t2;
#endif
typedef std::u16string t3; typedef std::u16string t3;
typedef std::u32string t4; typedef std::u32string t4;
} }
...@@ -36,6 +36,10 @@ typedef std::codecvt<wchar_t, char, std::mbstate_t> w_codecvt; ...@@ -36,6 +36,10 @@ typedef std::codecvt<wchar_t, char, std::mbstate_t> w_codecvt;
#ifdef _GLIBCXX_USE_C99_STDINT_TR1 #ifdef _GLIBCXX_USE_C99_STDINT_TR1
typedef std::codecvt<char16_t, char, std::mbstate_t> u16_codecvt; typedef std::codecvt<char16_t, char, std::mbstate_t> u16_codecvt;
typedef std::codecvt<char32_t, char, std::mbstate_t> u32_codecvt; typedef std::codecvt<char32_t, char, std::mbstate_t> u32_codecvt;
#ifdef _GLIBCXX_USE_CHAR8_T
typedef std::codecvt<char16_t, char8_t, std::mbstate_t> u16u8_codecvt;
typedef std::codecvt<char32_t, char8_t, std::mbstate_t> u32u8_codecvt;
#endif
#endif #endif
class gnu_facet: public std::locale::facet class gnu_facet: public std::locale::facet
...@@ -68,6 +72,10 @@ void test01() ...@@ -68,6 +72,10 @@ void test01()
#ifdef _GLIBCXX_USE_C99_STDINT_TR1 #ifdef _GLIBCXX_USE_C99_STDINT_TR1
VERIFY( has_facet<u16_codecvt>(loc13) ); VERIFY( has_facet<u16_codecvt>(loc13) );
VERIFY( has_facet<u32_codecvt>(loc13) ); VERIFY( has_facet<u32_codecvt>(loc13) );
#ifdef _GLIBCXX_USE_CHAR8_T
VERIFY( has_facet<u16u8_codecvt>(loc13) );
VERIFY( has_facet<u32u8_codecvt>(loc13) );
#endif
#endif #endif
VERIFY( has_facet<unicode_codecvt>(loc13) ); VERIFY( has_facet<unicode_codecvt>(loc13) );
} }
......
...@@ -27,5 +27,5 @@ int main() ...@@ -27,5 +27,5 @@ int main()
return 0; return 0;
} }
// { dg-error "deleted" "" { target *-*-* } 620 } // { dg-error "deleted" "" { target *-*-* } 639 }
// { dg-prune-output "include" } // { dg-prune-output "include" }
...@@ -27,5 +27,5 @@ int main() ...@@ -27,5 +27,5 @@ int main()
return 0; return 0;
} }
// { dg-error "deleted" "" { target *-*-* } 659 } // { dg-error "deleted" "" { target *-*-* } 678 }
// { dg-prune-output "include" } // { dg-prune-output "include" }
...@@ -28,5 +28,5 @@ int main() ...@@ -28,5 +28,5 @@ int main()
return 0; return 0;
} }
// { dg-error "deleted" "" { target *-*-* } 620 } // { dg-error "deleted" "" { target *-*-* } 639 }
// { dg-prune-output "include" } // { dg-prune-output "include" }
...@@ -28,5 +28,5 @@ int main() ...@@ -28,5 +28,5 @@ int main()
return 0; return 0;
} }
// { dg-error "deleted" "" { target *-*-* } 659 } // { dg-error "deleted" "" { target *-*-* } 678 }
// { dg-prune-output "include" } // { dg-prune-output "include" }
...@@ -39,5 +39,8 @@ static_assert( check<unsigned long>(ATOMIC_LONG_LOCK_FREE) ); ...@@ -39,5 +39,8 @@ static_assert( check<unsigned long>(ATOMIC_LONG_LOCK_FREE) );
static_assert( check<long long>(ATOMIC_LLONG_LOCK_FREE) ); static_assert( check<long long>(ATOMIC_LLONG_LOCK_FREE) );
static_assert( check<unsigned long long>(ATOMIC_LLONG_LOCK_FREE) ); static_assert( check<unsigned long long>(ATOMIC_LLONG_LOCK_FREE) );
static_assert( check<wchar_t>(ATOMIC_WCHAR_T_LOCK_FREE) ); static_assert( check<wchar_t>(ATOMIC_WCHAR_T_LOCK_FREE) );
#ifdef _GLIBCXX_USE_CHAR8_T
static_assert( check<char8_t>(ATOMIC_CHAR8_T_LOCK_FREE) );
#endif
static_assert( check<char16_t>(ATOMIC_CHAR16_T_LOCK_FREE) ); static_assert( check<char16_t>(ATOMIC_CHAR16_T_LOCK_FREE) );
static_assert( check<char32_t>(ATOMIC_CHAR32_T_LOCK_FREE) ); static_assert( check<char32_t>(ATOMIC_CHAR32_T_LOCK_FREE) );
...@@ -26,8 +26,8 @@ int main() ...@@ -26,8 +26,8 @@ int main()
return 0; return 0;
} }
// { dg-error "operator" "" { target *-*-* } 476 } // { dg-error "operator" "" { target *-*-* } 495 }
// { dg-error "operator" "" { target *-*-* } 477 } // { dg-error "operator" "" { target *-*-* } 496 }
// { dg-error "operator" "" { target *-*-* } 478 } // { dg-error "operator" "" { target *-*-* } 497 }
// { dg-prune-output "declared here" } // { dg-prune-output "declared here" }
...@@ -27,6 +27,6 @@ int main() ...@@ -27,6 +27,6 @@ int main()
return 0; return 0;
} }
// { dg-error "operator" "" { target *-*-* } 428 } // { dg-error "operator" "" { target *-*-* } 447 }
// { dg-error "operator" "" { target *-*-* } 429 } // { dg-error "operator" "" { target *-*-* } 448 }
// { dg-error "operator" "" { target *-*-* } 430 } // { dg-error "operator" "" { target *-*-* } 449 }
...@@ -27,6 +27,6 @@ int main() ...@@ -27,6 +27,6 @@ int main()
return 0; return 0;
} }
// { dg-error "operator" "" { target *-*-* } 406 } // { dg-error "operator" "" { target *-*-* } 425 }
// { dg-error "operator" "" { target *-*-* } 407 } // { dg-error "operator" "" { target *-*-* } 426 }
// { dg-error "operator" "" { target *-*-* } 408 } // { dg-error "operator" "" { target *-*-* } 427 }
...@@ -36,6 +36,12 @@ static_assert(std::is_same<xpmr::string, ...@@ -36,6 +36,12 @@ static_assert(std::is_same<xpmr::string,
std::basic_string<char, std::char_traits<char>, std::basic_string<char, std::char_traits<char>,
xpmr::polymorphic_allocator<char>>>::value, xpmr::polymorphic_allocator<char>>>::value,
"pmr::string"); "pmr::string");
#ifdef _GLIBCXX_USE_CHAR8_T
static_assert(std::is_same<xpmr::u8string,
std::basic_string<char8_t, std::char_traits<char8_t>,
xpmr::polymorphic_allocator<char8_t>>>::value,
"pmr::u8string");
#endif
static_assert(std::is_same<xpmr::u16string, static_assert(std::is_same<xpmr::u16string,
std::basic_string<char16_t, std::char_traits<char16_t>, std::basic_string<char16_t, std::char_traits<char16_t>,
xpmr::polymorphic_allocator<char16_t>>>::value, xpmr::polymorphic_allocator<char16_t>>>::value,
......
...@@ -24,12 +24,16 @@ template<typename C, typename T> ...@@ -24,12 +24,16 @@ template<typename C, typename T>
using check2_t = std::experimental::fundamentals_v1::string_view; using check2_t = std::experimental::fundamentals_v1::string_view;
#ifdef _GLIBCXX_USE_CHAR8_T
using check3_t = std::experimental::fundamentals_v1::u8string_view;
#endif
#ifdef _GLIBCXX_USE_C99_STDINT_TR1 #ifdef _GLIBCXX_USE_C99_STDINT_TR1
using check3_t = std::experimental::fundamentals_v1::u16string_view; using check4_t = std::experimental::fundamentals_v1::u16string_view;
using check4_t = std::experimental::fundamentals_v1::u32string_view; using check5_t = std::experimental::fundamentals_v1::u32string_view;
#endif #endif
#ifdef _GLIBCXX_USE_WCHAR_T #ifdef _GLIBCXX_USE_WCHAR_T
using check5_t = std::experimental::fundamentals_v1::wstring_view; using check6_t = std::experimental::fundamentals_v1::wstring_view;
#endif #endif
...@@ -51,6 +51,7 @@ ...@@ -51,6 +51,7 @@
namespace __gnu_test namespace __gnu_test
{ {
using __gnu_cxx::typelist::null_type;
using __gnu_cxx::typelist::node; using __gnu_cxx::typelist::node;
using __gnu_cxx::typelist::transform; using __gnu_cxx::typelist::transform;
using __gnu_cxx::typelist::append; using __gnu_cxx::typelist::append;
...@@ -272,16 +273,23 @@ namespace __gnu_test ...@@ -272,16 +273,23 @@ namespace __gnu_test
typedef long long a11; typedef long long a11;
typedef unsigned long long a12; typedef unsigned long long a12;
typedef wchar_t a13; typedef wchar_t a13;
typedef node<_GLIBCXX_TYPELIST_CHAIN13(a1, a2, a3, a4, a5, a6, a7, a8, a9,
a10, a11, a12, a13)> basic_typelist;
#if __cplusplus >= 201103L #if __cplusplus >= 201103L
typedef char16_t a14; typedef char16_t a14;
typedef char32_t a15; typedef char32_t a15;
typedef node<_GLIBCXX_TYPELIST_CHAIN2(a14, a15)> cxx11_typelist;
typedef node<_GLIBCXX_TYPELIST_CHAIN15(a1, a2, a3, a4, a5, a6, a7, a8, a9,
a10, a11, a12, a13, a14, a15)> type;
#else #else
typedef node<_GLIBCXX_TYPELIST_CHAIN13(a1, a2, a3, a4, a5, a6, a7, a8, a9, typedef node<null_type> cxx11_typelist;
a10, a11, a12, a13)> type; #endif
#ifdef _GLIBCXX_USE_CHAR8_T
typedef char8_t a16;
typedef node<_GLIBCXX_TYPELIST_CHAIN1(a16)> char8_typelist;
#else
typedef node<null_type> char8_typelist;
#endif #endif
typedef typename append<basic_typelist, cxx11_typelist>::type tl1;
typedef typename append<tl1, char8_typelist>::type type;
}; };
// A typelist of all standard integral types + the GNU 128-bit types. // A typelist of all standard integral types + the GNU 128-bit types.
...@@ -300,32 +308,31 @@ namespace __gnu_test ...@@ -300,32 +308,31 @@ namespace __gnu_test
typedef long long a11; typedef long long a11;
typedef unsigned long long a12; typedef unsigned long long a12;
typedef wchar_t a13; typedef wchar_t a13;
typedef node<_GLIBCXX_TYPELIST_CHAIN13(a1, a2, a3, a4, a5, a6, a7, a8, a9,
a10, a11, a12, a13)> basic_typelist;
#if __cplusplus >= 201103L #if __cplusplus >= 201103L
typedef char16_t a14; typedef char16_t a14;
typedef char32_t a15; typedef char32_t a15;
# if !defined(__STRICT_ANSI__) && defined(_GLIBCXX_USE_INT128) typedef node<_GLIBCXX_TYPELIST_CHAIN2(a14, a15)> cxx11_typelist;
__extension__ typedef __int128 a16; #else
__extension__ typedef unsigned __int128 a17; typedef node<null_type> cxx11_typelist;
#endif
typedef node<_GLIBCXX_TYPELIST_CHAIN17(a1, a2, a3, a4, a5, a6, a7, a8, a9, #ifdef _GLIBCXX_USE_CHAR8_T
a10, a11, a12, a13, a14, a15, typedef char8_t a16;
a16, a17)> type; typedef node<_GLIBCXX_TYPELIST_CHAIN1(a16)> char8_typelist;
# else
typedef node<_GLIBCXX_TYPELIST_CHAIN15(a1, a2, a3, a4, a5, a6, a7, a8, a9,
a10, a11, a12, a13, a14, a15)> type;
# endif
#else #else
typedef node<null_type> char8_typelist;
#endif
# if !defined(__STRICT_ANSI__) && defined(_GLIBCXX_USE_INT128) # if !defined(__STRICT_ANSI__) && defined(_GLIBCXX_USE_INT128)
__extension__ typedef __int128 a14; __extension__ typedef __int128 a17;
__extension__ typedef unsigned __int128 a15; __extension__ typedef unsigned __int128 a18;
typedef node<_GLIBCXX_TYPELIST_CHAIN2(a17, a18)> int128_typelist;
typedef node<_GLIBCXX_TYPELIST_CHAIN15(a1, a2, a3, a4, a5, a6, a7, a8, a9, #else
a10, a11, a12, a13, a14, a15)> type; typedef node<null_type> int128_typelist;
# else
typedef node<_GLIBCXX_TYPELIST_CHAIN13(a1, a2, a3, a4, a5, a6, a7, a8, a9,
a10, a11, a12, a13)> type;
# endif
#endif #endif
typedef typename append<basic_typelist, cxx11_typelist>::type tl1;
typedef typename append<tl1, char8_typelist>::type tl2;
typedef typename append<tl2, int128_typelist>::type type;
}; };
#if __cplusplus >= 201103L #if __cplusplus >= 201103L
...@@ -345,9 +352,15 @@ namespace __gnu_test ...@@ -345,9 +352,15 @@ namespace __gnu_test
typedef std::atomic_wchar_t a13; typedef std::atomic_wchar_t a13;
typedef std::atomic_char16_t a14; typedef std::atomic_char16_t a14;
typedef std::atomic_char32_t a15; typedef std::atomic_char32_t a15;
typedef node<_GLIBCXX_TYPELIST_CHAIN14(a2, a3, a4, a5, a6, a7, a8, a9, a10,
typedef node<_GLIBCXX_TYPELIST_CHAIN14(a2, a3, a4, a5, a6, a7, a8, a9, a11, a12, a13, a14, a15)> basic_typelist;
a10, a11, a12, a13, a14, a15)> type; #ifdef _GLIBCXX_USE_CHAR8_T
typedef std::atomic_char8_t a16;
typedef node<_GLIBCXX_TYPELIST_CHAIN1(a16)> char8_typelist;
#else
typedef node<null_type> char8_typelist;
#endif
typedef typename append<basic_typelist, char8_typelist>::type type;
}; };
struct atomic_integrals struct atomic_integrals
...@@ -367,9 +380,15 @@ namespace __gnu_test ...@@ -367,9 +380,15 @@ namespace __gnu_test
typedef std::atomic_wchar_t a13; typedef std::atomic_wchar_t a13;
typedef std::atomic_char16_t a14; typedef std::atomic_char16_t a14;
typedef std::atomic_char32_t a15; typedef std::atomic_char32_t a15;
typedef node<_GLIBCXX_TYPELIST_CHAIN15(a1, a2, a3, a4, a5, a6, a7, a8, a9, typedef node<_GLIBCXX_TYPELIST_CHAIN15(a1, a2, a3, a4, a5, a6, a7, a8, a9,
a10, a11, a12, a13, a14, a15)> type; a10, a11, a12, a13, a14, a15)> basic_typelist;
#ifdef _GLIBCXX_USE_CHAR8_T
typedef std::atomic_char8_t a16;
typedef node<_GLIBCXX_TYPELIST_CHAIN1(a16)> char8_typelist;
#else
typedef node<null_type> char8_typelist;
#endif
typedef typename append<basic_typelist, char8_typelist>::type type;
}; };
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment