@@ -153,11 +153,11 @@ using BorrowedContiguousSizedRange = BasicRange<int, true>;
153153template <typename T, size_t Extent = dynamic_extent>
154154constexpr void FunctionTakingSpan (type_identity_t <span<T, Extent>>) {}
155155
156- template <typename U, typename = void >
157- constexpr bool AsWritableBytesCompilesFor = false ;
156+ template <typename U>
157+ constexpr bool AsBytesCompilesFor = requires { as_bytes (declval<U>()); } ;
158158
159159template <typename U>
160- constexpr bool AsWritableBytesCompilesFor<U, void_t < decltype ( as_writable_bytes(declval<U>()))>> = true ;
160+ constexpr bool AsWritableBytesCompilesFor = requires { as_writable_bytes (declval<U>()); } ;
161161
162162constexpr bool test () {
163163 {
@@ -1016,10 +1016,23 @@ void test_non_constexpr() {
10161016 static_assert (noexcept (as_writable_bytes (sp_dyn)));
10171017 static_assert (noexcept (as_writable_bytes (sp_nine)));
10181018
1019+ static_assert (AsBytesCompilesFor<span<int >>);
1020+ static_assert (AsBytesCompilesFor<span<int , 5 >>);
1021+ static_assert (AsBytesCompilesFor<span<const int >>);
1022+ static_assert (AsBytesCompilesFor<span<const int , 6 >>);
1023+ static_assert (!AsBytesCompilesFor<span<volatile int >>);
1024+ static_assert (!AsBytesCompilesFor<span<volatile int , 7 >>);
1025+ static_assert (!AsBytesCompilesFor<span<const volatile int >>);
1026+ static_assert (!AsBytesCompilesFor<span<const volatile int , 8 >>);
1027+
10191028 static_assert (AsWritableBytesCompilesFor<span<int >>);
10201029 static_assert (AsWritableBytesCompilesFor<span<int , 9 >>);
10211030 static_assert (!AsWritableBytesCompilesFor<span<const int >>);
1022- static_assert (!AsWritableBytesCompilesFor<span<const int , 9 >>);
1031+ static_assert (!AsWritableBytesCompilesFor<span<const int , 10 >>);
1032+ static_assert (!AsWritableBytesCompilesFor<span<volatile int >>);
1033+ static_assert (!AsWritableBytesCompilesFor<span<volatile int , 11 >>);
1034+ static_assert (!AsWritableBytesCompilesFor<span<const volatile int >>);
1035+ static_assert (!AsWritableBytesCompilesFor<span<const volatile int , 12 >>);
10231036
10241037 auto sp_1 = as_bytes (sp_dyn);
10251038 auto sp_2 = as_bytes (sp_nine);
0 commit comments