From 351f40c63bfcddb455d65eff2016dbcc3691baf8 Mon Sep 17 00:00:00 2001 From: Sam Huang Date: Tue, 26 Jul 2022 12:36:21 -0700 Subject: [PATCH 1/4] Implement P2499R0 --- stl/inc/xstring | 2 +- tests/std/tests/P0220R1_string_view/test.cpp | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/stl/inc/xstring b/stl/inc/xstring index 3ec6219b53..7df86d1024 100644 --- a/stl/inc/xstring +++ b/stl/inc/xstring @@ -1297,7 +1297,7 @@ public: && (!requires { typename remove_reference_t<_Range>::traits_type; } || same_as::traits_type, _Traits>)) - constexpr basic_string_view(_Range&& _Rng) noexcept( + constexpr explicit basic_string_view(_Range&& _Rng) noexcept( noexcept(_RANGES data(_Rng)) && noexcept(_RANGES size(_Rng))) // strengthened : _Mydata(_RANGES data(_Rng)), _Mysize(static_cast(_RANGES size(_Rng))) {} // clang-format on diff --git a/tests/std/tests/P0220R1_string_view/test.cpp b/tests/std/tests/P0220R1_string_view/test.cpp index 3a490ed738..630575070c 100644 --- a/tests/std/tests/P0220R1_string_view/test.cpp +++ b/tests/std/tests/P0220R1_string_view/test.cpp @@ -352,7 +352,9 @@ constexpr bool test_case_range_constructor() { // Also tests some of the constraints: static_assert(is_constructible_v>); - static_assert(is_convertible_v, string_view>); + + // P2499R0 string_view Range Constructor Should Be explicit + static_assert(!is_convertible_v, string_view>); static_assert(!is_constructible_v>); // not contiguous static_assert(!is_convertible_v, string_view>); From b99f3fee6141f0fdda4256377ead2d3ee51d0bab Mon Sep 17 00:00:00 2001 From: Sam Huang Date: Tue, 26 Jul 2022 13:19:08 -0700 Subject: [PATCH 2/4] Add entry in `yvals_core.h` --- stl/inc/yvals_core.h | 1 + 1 file changed, 1 insertion(+) diff --git a/stl/inc/yvals_core.h b/stl/inc/yvals_core.h index b9064e29e8..22844af499 100644 --- a/stl/inc/yvals_core.h +++ b/stl/inc/yvals_core.h @@ -315,6 +315,7 @@ // P2441R2 views::join_with // P2442R1 Windowing Range Adaptors: views::chunk, views::slide // P2443R1 views::chunk_by +// P2499R0 string_view Range Constructor Should Be explicit // P2549R0 unexpected::error() // Parallel Algorithms Notes From 05a7436dc1b61eb2df7b4789a50a0ce145368e43 Mon Sep 17 00:00:00 2001 From: Sam Huang Date: Tue, 26 Jul 2022 13:25:01 -0700 Subject: [PATCH 3/4] libc++ hasn't implemented the proposal yet --- tests/libcxx/expected_results.txt | 3 +++ tests/libcxx/skipped_tests.txt | 3 +++ 2 files changed, 6 insertions(+) diff --git a/tests/libcxx/expected_results.txt b/tests/libcxx/expected_results.txt index eb882b5a45..c76dc27cc5 100644 --- a/tests/libcxx/expected_results.txt +++ b/tests/libcxx/expected_results.txt @@ -66,6 +66,9 @@ std/utilities/format/format.formatter/format.parse.ctx/begin.pass.cpp FAIL std/utilities/format/format.formatter/format.parse.ctx/ctor.pass.cpp FAIL std/utilities/format/format.formatter/format.parse.ctx/end.pass.cpp FAIL +# libc++ doesn't yet implement P2499R0 +std/strings/string.view/string.view.deduct/range.pass.cpp FAIL + # libc++ doesn't correctly constrain the iterator_traits specialization for common_iterator (https://reviews.llvm.org/D117449) std/iterators/predef.iterators/iterators.common/iterator_traits.compile.pass.cpp FAIL diff --git a/tests/libcxx/skipped_tests.txt b/tests/libcxx/skipped_tests.txt index fdc14350d3..c4a93381b4 100644 --- a/tests/libcxx/skipped_tests.txt +++ b/tests/libcxx/skipped_tests.txt @@ -66,6 +66,9 @@ utilities\format\format.formatter\format.parse.ctx\begin.pass.cpp utilities\format\format.formatter\format.parse.ctx\ctor.pass.cpp utilities\format\format.formatter\format.parse.ctx\end.pass.cpp +# libc++ doesn't yet implement P2499R0 +strings\string.view\string.view.deduct\range.pass.cpp + # libc++ doesn't correctly constrain the iterator_traits specialization for common_iterator (https://reviews.llvm.org/D117449) iterators\predef.iterators\iterators.common\iterator_traits.compile.pass.cpp From 95df18754af6a034045fed75b0157fb5671d4ff4 Mon Sep 17 00:00:00 2001 From: Sam Huang Date: Tue, 26 Jul 2022 14:16:56 -0700 Subject: [PATCH 4/4] Skip one more libc++ test --- tests/libcxx/expected_results.txt | 1 + tests/libcxx/skipped_tests.txt | 1 + 2 files changed, 2 insertions(+) diff --git a/tests/libcxx/expected_results.txt b/tests/libcxx/expected_results.txt index c76dc27cc5..fbcbf0bcc0 100644 --- a/tests/libcxx/expected_results.txt +++ b/tests/libcxx/expected_results.txt @@ -67,6 +67,7 @@ std/utilities/format/format.formatter/format.parse.ctx/ctor.pass.cpp FAIL std/utilities/format/format.formatter/format.parse.ctx/end.pass.cpp FAIL # libc++ doesn't yet implement P2499R0 +std/strings/string.view/string.view.cons/from_range.pass.cpp FAIL std/strings/string.view/string.view.deduct/range.pass.cpp FAIL # libc++ doesn't correctly constrain the iterator_traits specialization for common_iterator (https://reviews.llvm.org/D117449) diff --git a/tests/libcxx/skipped_tests.txt b/tests/libcxx/skipped_tests.txt index c4a93381b4..018270b829 100644 --- a/tests/libcxx/skipped_tests.txt +++ b/tests/libcxx/skipped_tests.txt @@ -67,6 +67,7 @@ utilities\format\format.formatter\format.parse.ctx\ctor.pass.cpp utilities\format\format.formatter\format.parse.ctx\end.pass.cpp # libc++ doesn't yet implement P2499R0 +strings\string.view\string.view.cons\from_range.pass.cpp strings\string.view\string.view.deduct\range.pass.cpp # libc++ doesn't correctly constrain the iterator_traits specialization for common_iterator (https://reviews.llvm.org/D117449)