diff --git a/libcxx/docs/Status/Cxx20Issues.csv b/libcxx/docs/Status/Cxx20Issues.csv --- a/libcxx/docs/Status/Cxx20Issues.csv +++ b/libcxx/docs/Status/Cxx20Issues.csv @@ -277,7 +277,7 @@ "`3369 `__","``span``\ 's deduction-guide for built-in arrays doesn't work","Prague","|Complete|","14.0" "`3371 `__","``visit_format_arg``\ and ``make_format_args``\ are not hidden friends","Prague","|Complete|","14.0","|format|" "`3372 `__","``vformat_to``\ should not try to deduce ``Out``\ twice","Prague","|Complete|","14.0","|format|" -"`3373 `__","``{to,from}_chars_result``\ and ``format_to_n_result``\ need the ""we really mean what we say"" wording","Prague","","","|format|" +"`3373 `__","``{to,from}_chars_result``\ and ``format_to_n_result``\ need the ""we really mean what we say"" wording","Prague","|Complete|","14.0","|format|" "`3374 `__","P0653 + P1006 should have made the other ``std::to_address``\ overload ``constexpr``\ ","Prague","|Complete|","12.0" "`3375 `__","``decay``\ in ``viewable_range``\ should be ``remove_cvref``\ ","Prague","","","|ranges|" "`3377 `__","``elements_view::iterator``\ befriends a specialization of itself","Prague","","","|ranges|" diff --git a/libcxx/test/std/utilities/charconv/charconv.syn/from_chars_result.pass.cpp b/libcxx/test/std/utilities/charconv/charconv.syn/from_chars_result.pass.cpp --- a/libcxx/test/std/utilities/charconv/charconv.syn/from_chars_result.pass.cpp +++ b/libcxx/test/std/utilities/charconv/charconv.syn/from_chars_result.pass.cpp @@ -6,14 +6,19 @@ // //===----------------------------------------------------------------------===// -// UNSUPPORTED: c++03, c++11, c++14, c++17 -// UNSUPPORTED: libcpp-no-concepts +// UNSUPPORTED: c++03, c++11, c++14 +// UNSUPPORTED: c++20 && libcpp-no-concepts // // struct from_chars_result // friend bool operator==(const from_chars_result&, const from_chars_result&) = default; +// [charconv.syn]/2 +// The types to_chars_result and from_chars_result have the data members and +// special members specified above. They have no base classes or members other +// than those specified. + #include #include @@ -24,17 +29,26 @@ constexpr bool test() { std::from_chars_result lhs{nullptr, std::errc{}}; +#if TEST_STD_VER > 17 std::from_chars_result rhs{nullptr, std::errc{}}; assert(lhs == rhs); assert(!(lhs != rhs)); +#endif + auto [ptr, ec] = lhs; + static_assert(std::is_same_v); + assert(ptr == lhs.ptr); + static_assert(std::is_same_v); + assert(ec == lhs.ec); return true; } int main(int, char**) { +#if TEST_STD_VER > 17 static_assert(std::equality_comparable); static_assert(!std::totally_ordered); static_assert(!std::three_way_comparable); +#endif assert(test()); static_assert(test()); diff --git a/libcxx/test/std/utilities/charconv/charconv.syn/to_chars_result.pass.cpp b/libcxx/test/std/utilities/charconv/charconv.syn/to_chars_result.pass.cpp --- a/libcxx/test/std/utilities/charconv/charconv.syn/to_chars_result.pass.cpp +++ b/libcxx/test/std/utilities/charconv/charconv.syn/to_chars_result.pass.cpp @@ -6,14 +6,19 @@ // //===----------------------------------------------------------------------===// -// UNSUPPORTED: c++03, c++11, c++14, c++17 -// UNSUPPORTED: libcpp-no-concepts +// UNSUPPORTED: c++03, c++11, c++14 +// UNSUPPORTED: c++20 && libcpp-no-concepts // // struct to_chars_result // friend bool operator==(const to_chars_result&, const to_chars_result&) = default; +// [charconv.syn]/2 +// The types to_chars_result and from_chars_result have the data members and +// special members specified above. They have no base classes or members other +// than those specified. + #include #include @@ -24,17 +29,26 @@ constexpr bool test() { std::to_chars_result lhs{nullptr, std::errc{}}; +#if TEST_STD_VER > 17 std::to_chars_result rhs{nullptr, std::errc{}}; assert(lhs == rhs); assert(!(lhs != rhs)); +#endif + auto [ptr, ec] = lhs; + static_assert(std::is_same_v); + assert(ptr == lhs.ptr); + static_assert(std::is_same_v); + assert(ec == lhs.ec); return true; } int main(int, char**) { +#if TEST_STD_VER > 17 static_assert(std::equality_comparable); static_assert(!std::totally_ordered); static_assert(!std::three_way_comparable); +#endif assert(test()); static_assert(test()); diff --git a/libcxx/test/std/utilities/format/format.syn/format_to_n_result.pass.cpp b/libcxx/test/std/utilities/format/format.syn/format_to_n_result.pass.cpp new file mode 100644 --- /dev/null +++ b/libcxx/test/std/utilities/format/format.syn/format_to_n_result.pass.cpp @@ -0,0 +1,52 @@ +//===----------------------------------------------------------------------===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +// UNSUPPORTED: c++03, c++11, c++14, c++17 +// UNSUPPORTED: libcpp-no-concepts + +// + +// struct format_to_n_result + +// [format.syn]/1 +// The class template format_to_n_result has the template parameters, data +// members, and special members specified above. It has no base classes or +// members other than those specified. + +#include + +#include +#include + +#include "test_macros.h" + +template +constexpr void test() { + std::format_to_n_result v{nullptr, std::iter_difference_t{42}}; + + auto [out, size] = v; + static_assert(std::same_as); + assert(out == v.out); + static_assert(std::same_as>); + assert(size == v.size); +} + +constexpr bool test() { + test(); +#ifndef TEST_HAS_NO_WIDE_CHARACTERS + test(); +#endif + return true; +} + +int main(int, char**) { + assert(test()); + static_assert(test()); + + return 0; +}