+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
static_assert( test_to_integer<int>(0) );
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<unsigned>(0) );
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) );
do_test<signed char>();
do_test<unsigned char>();
do_test<wchar_t>();
+#ifdef _GLIBCXX_USE_CHAR8_T
+ do_test<char8_t>();
+#endif
do_test<char16_t>();
do_test<char32_t>();
do_test<short>();
do_test<unsigned char>();
#ifdef _GLIBCXX_USE_WCHAR_T
do_test<wchar_t>();
+#endif
+#ifdef _GLIBCXX_USE_CHAR8_T
+ do_test<char8_t>();
#endif
do_test<char16_t>();
do_test<char32_t>();
VERIFY( std::numeric_limits<unsigned long>::max_digits10 == 0 );
VERIFY( std::numeric_limits<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<char32_t>::max_digits10 == 0 );
gen_type_info<long long>();
gen_type_info<unsigned long long>();
gen_type_info<wchar_t>();
+#ifdef _GLIBCXX_USE_CHAR8_T
+ gen_type_info<char8_t>();
+#endif
gen_type_info<char16_t>();
gen_type_info<char32_t>();
--- /dev/null
+// 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" }
+}
template class std::hash<char>;
template class std::hash<signed 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<char32_t>;
template class std::hash<short>;
static_assert(test_category<is_integral, unsigned char>(true), "");
#ifdef _GLIBCXX_USE_WCHAR_T
static_assert(test_category<is_integral, wchar_t>(true), "");
+#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, char32_t>(true), "");
using wchar_unsigned = make_unsigned<wchar_t>::type;
static_assert( !is_same<wchar_signed, wchar_unsigned>::value, "wchar_t" );
#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<char32_t>::type>::value, "char32_t");
void
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
std::string_view sv{"A View to a Kill"};
}
void
-test06()
+test07()
{
// LWG 3076 basic_string CTAD ambiguity
using namespace std;
static_assert(std::is_same_v<std::pmr::string,
std::basic_string<char, std::char_traits<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,
std::basic_string<char16_t, std::char_traits<char16_t>,
std::pmr::polymorphic_allocator<char16_t>>>);
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;
constexpr
using check2_t = std::string_view;
+#ifdef _GLIBCXX_USE_CHAR8_T
+using check3_t = std::u8string_view;
+#endif
+
#ifdef _GLIBCXX_USE_C99_STDINT_TR1
-using check3_t = std::u16string_view;
-using check4_t = std::u32string_view;
+using check4_t = std::u16string_view;
+using check5_t = std::u32string_view;
#endif
#ifdef _GLIBCXX_USE_WCHAR_T
-using check5_t = std::wstring_view;
+using check6_t = std::wstring_view;
#endif
-
test.operator()<std::char_traits<char>>();
#ifdef _GLIBCXX_USE_WCHAR_T
test.operator()<std::char_traits<wchar_t>>();
+#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<char32_t>>();
static_assert( test_length<std::char_traits<wchar_t>>() );
static_assert( test_find<std::char_traits<wchar_t>>() );
#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_compare<std::char_traits<char16_t>>() );
static_assert( test_length<std::char_traits<char16_t>>() );
namespace gnu
{
+#ifdef _GLIBCXX_USE_CHAR8_T
+ typedef std::u8string t2;
+#endif
typedef std::u16string t3;
typedef std::u32string t4;
}
#ifdef _GLIBCXX_USE_C99_STDINT_TR1
typedef std::codecvt<char16_t, char, std::mbstate_t> u16_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
class gnu_facet: public std::locale::facet
#ifdef _GLIBCXX_USE_C99_STDINT_TR1
VERIFY( has_facet<u16_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
VERIFY( has_facet<unicode_codecvt>(loc13) );
}
return 0;
}
-// { dg-error "deleted" "" { target *-*-* } 620 }
+// { dg-error "deleted" "" { target *-*-* } 639 }
// { dg-prune-output "include" }
return 0;
}
-// { dg-error "deleted" "" { target *-*-* } 659 }
+// { dg-error "deleted" "" { target *-*-* } 678 }
// { dg-prune-output "include" }
return 0;
}
-// { dg-error "deleted" "" { target *-*-* } 620 }
+// { dg-error "deleted" "" { target *-*-* } 639 }
// { dg-prune-output "include" }
return 0;
}
-// { dg-error "deleted" "" { target *-*-* } 659 }
+// { dg-error "deleted" "" { target *-*-* } 678 }
// { dg-prune-output "include" }
static_assert( check<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) );
+#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<char32_t>(ATOMIC_CHAR32_T_LOCK_FREE) );
return 0;
}
-// { dg-error "operator" "" { target *-*-* } 476 }
-// { dg-error "operator" "" { target *-*-* } 477 }
-// { dg-error "operator" "" { target *-*-* } 478 }
+// { dg-error "operator" "" { target *-*-* } 495 }
+// { dg-error "operator" "" { target *-*-* } 496 }
+// { dg-error "operator" "" { target *-*-* } 497 }
// { dg-prune-output "declared here" }
return 0;
}
-// { dg-error "operator" "" { target *-*-* } 428 }
-// { dg-error "operator" "" { target *-*-* } 429 }
-// { dg-error "operator" "" { target *-*-* } 430 }
+// { dg-error "operator" "" { target *-*-* } 447 }
+// { dg-error "operator" "" { target *-*-* } 448 }
+// { dg-error "operator" "" { target *-*-* } 449 }
return 0;
}
-// { dg-error "operator" "" { target *-*-* } 406 }
-// { dg-error "operator" "" { target *-*-* } 407 }
-// { dg-error "operator" "" { target *-*-* } 408 }
+// { dg-error "operator" "" { target *-*-* } 425 }
+// { dg-error "operator" "" { target *-*-* } 426 }
+// { dg-error "operator" "" { target *-*-* } 427 }
std::basic_string<char, std::char_traits<char>,
xpmr::polymorphic_allocator<char>>>::value,
"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,
std::basic_string<char16_t, std::char_traits<char16_t>,
xpmr::polymorphic_allocator<char16_t>>>::value,
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
-using check3_t = std::experimental::fundamentals_v1::u16string_view;
-using check4_t = std::experimental::fundamentals_v1::u32string_view;
+using check4_t = std::experimental::fundamentals_v1::u16string_view;
+using check5_t = std::experimental::fundamentals_v1::u32string_view;
#endif
#ifdef _GLIBCXX_USE_WCHAR_T
-using check5_t = std::experimental::fundamentals_v1::wstring_view;
+using check6_t = std::experimental::fundamentals_v1::wstring_view;
#endif
namespace __gnu_test
{
+ using __gnu_cxx::typelist::null_type;
using __gnu_cxx::typelist::node;
using __gnu_cxx::typelist::transform;
using __gnu_cxx::typelist::append;
typedef long long a11;
typedef unsigned long long a12;
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
typedef char16_t a14;
typedef char32_t a15;
-
- typedef node<_GLIBCXX_TYPELIST_CHAIN15(a1, a2, a3, a4, a5, a6, a7, a8, a9,
- a10, a11, a12, a13, a14, a15)> type;
+ typedef node<_GLIBCXX_TYPELIST_CHAIN2(a14, a15)> cxx11_typelist;
#else
- typedef node<_GLIBCXX_TYPELIST_CHAIN13(a1, a2, a3, a4, a5, a6, a7, a8, a9,
- a10, a11, a12, a13)> type;
+ typedef node<null_type> cxx11_typelist;
+#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
+ 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.
typedef long long a11;
typedef unsigned long long a12;
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
typedef char16_t a14;
typedef char32_t a15;
-# if !defined(__STRICT_ANSI__) && defined(_GLIBCXX_USE_INT128)
- __extension__ typedef __int128 a16;
- __extension__ typedef unsigned __int128 a17;
-
- typedef node<_GLIBCXX_TYPELIST_CHAIN17(a1, a2, a3, a4, a5, a6, a7, a8, a9,
- a10, a11, a12, a13, a14, a15,
- a16, a17)> type;
-# else
- typedef node<_GLIBCXX_TYPELIST_CHAIN15(a1, a2, a3, a4, a5, a6, a7, a8, a9,
- a10, a11, a12, a13, a14, a15)> type;
-# endif
+ typedef node<_GLIBCXX_TYPELIST_CHAIN2(a14, a15)> cxx11_typelist;
+#else
+ typedef node<null_type> cxx11_typelist;
+#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
# if !defined(__STRICT_ANSI__) && defined(_GLIBCXX_USE_INT128)
- __extension__ typedef __int128 a14;
- __extension__ typedef unsigned __int128 a15;
-
- typedef node<_GLIBCXX_TYPELIST_CHAIN15(a1, a2, a3, a4, a5, a6, a7, a8, a9,
- a10, a11, a12, a13, a14, a15)> type;
-# else
- typedef node<_GLIBCXX_TYPELIST_CHAIN13(a1, a2, a3, a4, a5, a6, a7, a8, a9,
- a10, a11, a12, a13)> type;
-# endif
+ __extension__ typedef __int128 a17;
+ __extension__ typedef unsigned __int128 a18;
+ typedef node<_GLIBCXX_TYPELIST_CHAIN2(a17, a18)> int128_typelist;
+#else
+ typedef node<null_type> int128_typelist;
#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
typedef std::atomic_wchar_t a13;
typedef std::atomic_char16_t a14;
typedef std::atomic_char32_t a15;
-
- typedef node<_GLIBCXX_TYPELIST_CHAIN14(a2, a3, a4, a5, a6, a7, a8, a9,
- a10, a11, a12, a13, a14, a15)> type;
+ typedef node<_GLIBCXX_TYPELIST_CHAIN14(a2, a3, a4, a5, a6, a7, a8, a9, 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;
};
struct atomic_integrals
typedef std::atomic_wchar_t a13;
typedef std::atomic_char16_t a14;
typedef std::atomic_char32_t a15;
-
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;
};