summaryrefslogtreecommitdiff
path: root/libstdc++-v3
diff options
context:
space:
mode:
authorTom Honermann <tom@honermann.net>2019-02-22 01:16:08 +0000
committerJonathan Wakely <redi@gcc.gnu.org>2019-02-22 01:16:08 +0000
commit59019b4223633066d86d46147bc2c01de8d9da22 (patch)
tree79b2a1ebd43116878ad44eb2391e5b02f0d8555d /libstdc++-v3
parent65bbaf3125f7c92be32e2e3b6c07e63e8ab0ccbc (diff)
downloadgcc-59019b4223633066d86d46147bc2c01de8d9da22.tar.gz
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
Diffstat (limited to 'libstdc++-v3')
-rw-r--r--libstdc++-v3/ChangeLog61
-rw-r--r--libstdc++-v3/testsuite/18_support/byte/ops.cc10
-rw-r--r--libstdc++-v3/testsuite/18_support/numeric_limits/dr559.cc3
-rw-r--r--libstdc++-v3/testsuite/18_support/numeric_limits/lowest.cc3
-rw-r--r--libstdc++-v3/testsuite/18_support/numeric_limits/max_digits10.cc3
-rw-r--r--libstdc++-v3/testsuite/18_support/type_info/fundamental.cc3
-rw-r--r--libstdc++-v3/testsuite/20_util/from_chars/1_c++20_neg.cc38
-rw-r--r--libstdc++-v3/testsuite/20_util/hash/requirements/explicit_instantiation.cc3
-rw-r--r--libstdc++-v3/testsuite/20_util/is_integral/value.cc3
-rw-r--r--libstdc++-v3/testsuite/20_util/make_signed/requirements/typedefs-4.cc3
-rw-r--r--libstdc++-v3/testsuite/21_strings/basic_string/cons/char/deduction.cc23
-rw-r--r--libstdc++-v3/testsuite/21_strings/basic_string/types/pmr_typedefs.cc5
-rw-r--r--libstdc++-v3/testsuite/21_strings/basic_string_view/operations/compare/char/70483.cc19
-rw-r--r--libstdc++-v3/testsuite/21_strings/basic_string_view/typedefs.cc11
-rw-r--r--libstdc++-v3/testsuite/21_strings/char_traits/requirements/constexpr_functions.cc3
-rw-r--r--libstdc++-v3/testsuite/21_strings/char_traits/requirements/constexpr_functions_c++17.cc6
-rw-r--r--libstdc++-v3/testsuite/21_strings/headers/string/types_std_c++0x.cc3
-rw-r--r--libstdc++-v3/testsuite/22_locale/locale/cons/unicode.cc8
-rw-r--r--libstdc++-v3/testsuite/29_atomics/atomic/cons/assign_neg.cc2
-rw-r--r--libstdc++-v3/testsuite/29_atomics/atomic/cons/copy_neg.cc2
-rw-r--r--libstdc++-v3/testsuite/29_atomics/atomic_integral/cons/assign_neg.cc2
-rw-r--r--libstdc++-v3/testsuite/29_atomics/atomic_integral/cons/copy_neg.cc2
-rw-r--r--libstdc++-v3/testsuite/29_atomics/atomic_integral/is_always_lock_free.cc3
-rw-r--r--libstdc++-v3/testsuite/29_atomics/atomic_integral/operators/bitwise_neg.cc6
-rw-r--r--libstdc++-v3/testsuite/29_atomics/atomic_integral/operators/decrement_neg.cc6
-rw-r--r--libstdc++-v3/testsuite/29_atomics/atomic_integral/operators/increment_neg.cc6
-rw-r--r--libstdc++-v3/testsuite/experimental/polymorphic_allocator/pmr_typedefs_string.cc6
-rw-r--r--libstdc++-v3/testsuite/experimental/string_view/typedefs.cc10
-rw-r--r--libstdc++-v3/testsuite/util/testsuite_common_types.h79
29 files changed, 280 insertions, 52 deletions
diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog
index 904da1ba4c9..b94e30f12a8 100644
--- a/libstdc++-v3/ChangeLog
+++ b/libstdc++-v3/ChangeLog
@@ -1,5 +1,66 @@
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
typelist::detail::append_ to only match chain<T1,T2>.
diff --git a/libstdc++-v3/testsuite/18_support/byte/ops.cc b/libstdc++-v3/testsuite/18_support/byte/ops.cc
index 37a75fa2a32..6b01c1c38f0 100644
--- a/libstdc++-v3/testsuite/18_support/byte/ops.cc
+++ b/libstdc++-v3/testsuite/18_support/byte/ops.cc
@@ -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>(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) );
diff --git a/libstdc++-v3/testsuite/18_support/numeric_limits/dr559.cc b/libstdc++-v3/testsuite/18_support/numeric_limits/dr559.cc
index bf6dac73b0b..504866b636a 100644
--- a/libstdc++-v3/testsuite/18_support/numeric_limits/dr559.cc
+++ b/libstdc++-v3/testsuite/18_support/numeric_limits/dr559.cc
@@ -84,6 +84,9 @@ int main()
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>();
diff --git a/libstdc++-v3/testsuite/18_support/numeric_limits/lowest.cc b/libstdc++-v3/testsuite/18_support/numeric_limits/lowest.cc
index 85466c5b538..82d9a0f9bf0 100644
--- a/libstdc++-v3/testsuite/18_support/numeric_limits/lowest.cc
+++ b/libstdc++-v3/testsuite/18_support/numeric_limits/lowest.cc
@@ -55,6 +55,9 @@ void test01()
#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>();
diff --git a/libstdc++-v3/testsuite/18_support/numeric_limits/max_digits10.cc b/libstdc++-v3/testsuite/18_support/numeric_limits/max_digits10.cc
index c0c3ab8aac8..c5475c508fd 100644
--- a/libstdc++-v3/testsuite/18_support/numeric_limits/max_digits10.cc
+++ b/libstdc++-v3/testsuite/18_support/numeric_limits/max_digits10.cc
@@ -42,6 +42,9 @@ test01()
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 );
diff --git a/libstdc++-v3/testsuite/18_support/type_info/fundamental.cc b/libstdc++-v3/testsuite/18_support/type_info/fundamental.cc
index 812c0103c68..717ebd6e149 100644
--- a/libstdc++-v3/testsuite/18_support/type_info/fundamental.cc
+++ b/libstdc++-v3/testsuite/18_support/type_info/fundamental.cc
@@ -50,6 +50,9 @@ int main()
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>();
diff --git a/libstdc++-v3/testsuite/20_util/from_chars/1_c++20_neg.cc b/libstdc++-v3/testsuite/20_util/from_chars/1_c++20_neg.cc
new file mode 100644
index 00000000000..83d297676bf
--- /dev/null
+++ b/libstdc++-v3/testsuite/20_util/from_chars/1_c++20_neg.cc
@@ -0,0 +1,38 @@
+// 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" }
+}
diff --git a/libstdc++-v3/testsuite/20_util/hash/requirements/explicit_instantiation.cc b/libstdc++-v3/testsuite/20_util/hash/requirements/explicit_instantiation.cc
index f143b4d910e..ff390fb5a34 100644
--- a/libstdc++-v3/testsuite/20_util/hash/requirements/explicit_instantiation.cc
+++ b/libstdc++-v3/testsuite/20_util/hash/requirements/explicit_instantiation.cc
@@ -26,6 +26,9 @@ template class std::hash<bool>;
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>;
diff --git a/libstdc++-v3/testsuite/20_util/is_integral/value.cc b/libstdc++-v3/testsuite/20_util/is_integral/value.cc
index 1e3c2e87f3a..1c3c412b94e 100644
--- a/libstdc++-v3/testsuite/20_util/is_integral/value.cc
+++ b/libstdc++-v3/testsuite/20_util/is_integral/value.cc
@@ -35,6 +35,9 @@ void test01()
#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), "");
static_assert(test_category<is_integral, short>(true), "");
diff --git a/libstdc++-v3/testsuite/20_util/make_signed/requirements/typedefs-4.cc b/libstdc++-v3/testsuite/20_util/make_signed/requirements/typedefs-4.cc
index 41744661454..27eb1012125 100644
--- a/libstdc++-v3/testsuite/20_util/make_signed/requirements/typedefs-4.cc
+++ b/libstdc++-v3/testsuite/20_util/make_signed/requirements/typedefs-4.cc
@@ -27,5 +27,8 @@ using wchar_signed = make_signed<wchar_t>::type;
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");
diff --git a/libstdc++-v3/testsuite/21_strings/basic_string/cons/char/deduction.cc b/libstdc++-v3/testsuite/21_strings/basic_string/cons/char/deduction.cc
index a6ffc41309e..6bb2554f07d 100644
--- a/libstdc++-v3/testsuite/21_strings/basic_string/cons/char/deduction.cc
+++ b/libstdc++-v3/testsuite/21_strings/basic_string/cons/char/deduction.cc
@@ -123,6 +123,27 @@ test04()
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"};
const std::allocator<char> a;
@@ -141,7 +162,7 @@ test05()
}
void
-test06()
+test07()
{
// LWG 3076 basic_string CTAD ambiguity
using namespace std;
diff --git a/libstdc++-v3/testsuite/21_strings/basic_string/types/pmr_typedefs.cc b/libstdc++-v3/testsuite/21_strings/basic_string/types/pmr_typedefs.cc
index 8565170d26e..4b443570ccd 100644
--- a/libstdc++-v3/testsuite/21_strings/basic_string/types/pmr_typedefs.cc
+++ b/libstdc++-v3/testsuite/21_strings/basic_string/types/pmr_typedefs.cc
@@ -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,
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>>>);
diff --git a/libstdc++-v3/testsuite/21_strings/basic_string_view/operations/compare/char/70483.cc b/libstdc++-v3/testsuite/21_strings/basic_string_view/operations/compare/char/70483.cc
index 9315d3b6595..29facb1eea7 100644
--- a/libstdc++-v3/testsuite/21_strings/basic_string_view/operations/compare/char/70483.cc
+++ b/libstdc++-v3/testsuite/21_strings/basic_string_view/operations/compare/char/70483.cc
@@ -58,6 +58,25 @@ string_view 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;
constexpr
diff --git a/libstdc++-v3/testsuite/21_strings/basic_string_view/typedefs.cc b/libstdc++-v3/testsuite/21_strings/basic_string_view/typedefs.cc
index 277d7ce8bcf..82bbe84f909 100644
--- a/libstdc++-v3/testsuite/21_strings/basic_string_view/typedefs.cc
+++ b/libstdc++-v3/testsuite/21_strings/basic_string_view/typedefs.cc
@@ -25,12 +25,15 @@ template<typename C, typename T>
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
-
diff --git a/libstdc++-v3/testsuite/21_strings/char_traits/requirements/constexpr_functions.cc b/libstdc++-v3/testsuite/21_strings/char_traits/requirements/constexpr_functions.cc
index 239aa48fcf7..93815ff6979 100644
--- a/libstdc++-v3/testsuite/21_strings/char_traits/requirements/constexpr_functions.cc
+++ b/libstdc++-v3/testsuite/21_strings/char_traits/requirements/constexpr_functions.cc
@@ -67,6 +67,9 @@ int main()
#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>>();
return 0;
diff --git a/libstdc++-v3/testsuite/21_strings/char_traits/requirements/constexpr_functions_c++17.cc b/libstdc++-v3/testsuite/21_strings/char_traits/requirements/constexpr_functions_c++17.cc
index db368ecb60a..92c301b1900 100644
--- a/libstdc++-v3/testsuite/21_strings/char_traits/requirements/constexpr_functions_c++17.cc
+++ b/libstdc++-v3/testsuite/21_strings/char_traits/requirements/constexpr_functions_c++17.cc
@@ -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_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>>() );
diff --git a/libstdc++-v3/testsuite/21_strings/headers/string/types_std_c++0x.cc b/libstdc++-v3/testsuite/21_strings/headers/string/types_std_c++0x.cc
index ab4440541e0..6e5cf8c78e6 100644
--- a/libstdc++-v3/testsuite/21_strings/headers/string/types_std_c++0x.cc
+++ b/libstdc++-v3/testsuite/21_strings/headers/string/types_std_c++0x.cc
@@ -21,6 +21,9 @@
namespace gnu
{
+#ifdef _GLIBCXX_USE_CHAR8_T
+ typedef std::u8string t2;
+#endif
typedef std::u16string t3;
typedef std::u32string t4;
}
diff --git a/libstdc++-v3/testsuite/22_locale/locale/cons/unicode.cc b/libstdc++-v3/testsuite/22_locale/locale/cons/unicode.cc
index fb8e12113f5..21b75341237 100644
--- a/libstdc++-v3/testsuite/22_locale/locale/cons/unicode.cc
+++ b/libstdc++-v3/testsuite/22_locale/locale/cons/unicode.cc
@@ -36,6 +36,10 @@ typedef std::codecvt<wchar_t, char, std::mbstate_t> w_codecvt;
#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
@@ -68,6 +72,10 @@ void test01()
#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) );
}
diff --git a/libstdc++-v3/testsuite/29_atomics/atomic/cons/assign_neg.cc b/libstdc++-v3/testsuite/29_atomics/atomic/cons/assign_neg.cc
index c9057b9c4d0..2431910f279 100644
--- a/libstdc++-v3/testsuite/29_atomics/atomic/cons/assign_neg.cc
+++ b/libstdc++-v3/testsuite/29_atomics/atomic/cons/assign_neg.cc
@@ -27,5 +27,5 @@ int main()
return 0;
}
-// { dg-error "deleted" "" { target *-*-* } 620 }
+// { dg-error "deleted" "" { target *-*-* } 639 }
// { dg-prune-output "include" }
diff --git a/libstdc++-v3/testsuite/29_atomics/atomic/cons/copy_neg.cc b/libstdc++-v3/testsuite/29_atomics/atomic/cons/copy_neg.cc
index 129a8bedf99..f962fa656da 100644
--- a/libstdc++-v3/testsuite/29_atomics/atomic/cons/copy_neg.cc
+++ b/libstdc++-v3/testsuite/29_atomics/atomic/cons/copy_neg.cc
@@ -27,5 +27,5 @@ int main()
return 0;
}
-// { dg-error "deleted" "" { target *-*-* } 659 }
+// { dg-error "deleted" "" { target *-*-* } 678 }
// { dg-prune-output "include" }
diff --git a/libstdc++-v3/testsuite/29_atomics/atomic_integral/cons/assign_neg.cc b/libstdc++-v3/testsuite/29_atomics/atomic_integral/cons/assign_neg.cc
index 320e1c99efc..381dfe7948e 100644
--- a/libstdc++-v3/testsuite/29_atomics/atomic_integral/cons/assign_neg.cc
+++ b/libstdc++-v3/testsuite/29_atomics/atomic_integral/cons/assign_neg.cc
@@ -28,5 +28,5 @@ int main()
return 0;
}
-// { dg-error "deleted" "" { target *-*-* } 620 }
+// { dg-error "deleted" "" { target *-*-* } 639 }
// { dg-prune-output "include" }
diff --git a/libstdc++-v3/testsuite/29_atomics/atomic_integral/cons/copy_neg.cc b/libstdc++-v3/testsuite/29_atomics/atomic_integral/cons/copy_neg.cc
index 81a1cea26b0..19d898d31f7 100644
--- a/libstdc++-v3/testsuite/29_atomics/atomic_integral/cons/copy_neg.cc
+++ b/libstdc++-v3/testsuite/29_atomics/atomic_integral/cons/copy_neg.cc
@@ -28,5 +28,5 @@ int main()
return 0;
}
-// { dg-error "deleted" "" { target *-*-* } 659 }
+// { dg-error "deleted" "" { target *-*-* } 678 }
// { dg-prune-output "include" }
diff --git a/libstdc++-v3/testsuite/29_atomics/atomic_integral/is_always_lock_free.cc b/libstdc++-v3/testsuite/29_atomics/atomic_integral/is_always_lock_free.cc
index 80d21f15243..127b47447f0 100644
--- a/libstdc++-v3/testsuite/29_atomics/atomic_integral/is_always_lock_free.cc
+++ b/libstdc++-v3/testsuite/29_atomics/atomic_integral/is_always_lock_free.cc
@@ -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<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) );
diff --git a/libstdc++-v3/testsuite/29_atomics/atomic_integral/operators/bitwise_neg.cc b/libstdc++-v3/testsuite/29_atomics/atomic_integral/operators/bitwise_neg.cc
index 646f823b01e..1ec82bc2e8f 100644
--- a/libstdc++-v3/testsuite/29_atomics/atomic_integral/operators/bitwise_neg.cc
+++ b/libstdc++-v3/testsuite/29_atomics/atomic_integral/operators/bitwise_neg.cc
@@ -26,8 +26,8 @@ int main()
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" }
diff --git a/libstdc++-v3/testsuite/29_atomics/atomic_integral/operators/decrement_neg.cc b/libstdc++-v3/testsuite/29_atomics/atomic_integral/operators/decrement_neg.cc
index 17ff1c29965..5479ceaf6fa 100644
--- a/libstdc++-v3/testsuite/29_atomics/atomic_integral/operators/decrement_neg.cc
+++ b/libstdc++-v3/testsuite/29_atomics/atomic_integral/operators/decrement_neg.cc
@@ -27,6 +27,6 @@ int main()
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 }
diff --git a/libstdc++-v3/testsuite/29_atomics/atomic_integral/operators/increment_neg.cc b/libstdc++-v3/testsuite/29_atomics/atomic_integral/operators/increment_neg.cc
index f5452949617..9858a6c9f1b 100644
--- a/libstdc++-v3/testsuite/29_atomics/atomic_integral/operators/increment_neg.cc
+++ b/libstdc++-v3/testsuite/29_atomics/atomic_integral/operators/increment_neg.cc
@@ -27,6 +27,6 @@ int main()
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 }
diff --git a/libstdc++-v3/testsuite/experimental/polymorphic_allocator/pmr_typedefs_string.cc b/libstdc++-v3/testsuite/experimental/polymorphic_allocator/pmr_typedefs_string.cc
index 757922177bd..62917e9373d 100644
--- a/libstdc++-v3/testsuite/experimental/polymorphic_allocator/pmr_typedefs_string.cc
+++ b/libstdc++-v3/testsuite/experimental/polymorphic_allocator/pmr_typedefs_string.cc
@@ -36,6 +36,12 @@ static_assert(std::is_same<xpmr::string,
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,
diff --git a/libstdc++-v3/testsuite/experimental/string_view/typedefs.cc b/libstdc++-v3/testsuite/experimental/string_view/typedefs.cc
index 01756348fd4..d270ee6f8bf 100644
--- a/libstdc++-v3/testsuite/experimental/string_view/typedefs.cc
+++ b/libstdc++-v3/testsuite/experimental/string_view/typedefs.cc
@@ -24,12 +24,16 @@ template<typename C, typename T>
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
diff --git a/libstdc++-v3/testsuite/util/testsuite_common_types.h b/libstdc++-v3/testsuite/util/testsuite_common_types.h
index c247f72e6fe..d992544b3aa 100644
--- a/libstdc++-v3/testsuite/util/testsuite_common_types.h
+++ b/libstdc++-v3/testsuite/util/testsuite_common_types.h
@@ -51,6 +51,7 @@
namespace __gnu_test
{
+ using __gnu_cxx::typelist::null_type;
using __gnu_cxx::typelist::node;
using __gnu_cxx::typelist::transform;
using __gnu_cxx::typelist::append;
@@ -272,16 +273,23 @@ namespace __gnu_test
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.
@@ -300,32 +308,31 @@ namespace __gnu_test
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
@@ -345,9 +352,15 @@ namespace __gnu_test
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
@@ -367,9 +380,15 @@ namespace __gnu_test
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;
};