Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[libc++][test] Change forbidden extents<char> to extents<signed char> #73535

Merged
merged 3 commits into from
Nov 28, 2023

Conversation

StephanTLavavej
Copy link
Member

@StephanTLavavej StephanTLavavej commented Nov 27, 2023

Found while running libc++'s test suite with MSVC's STL.

N4964 [mdspan.extents.overview]/1.1:

template<class IndexType, size_t... Extents>
class extents {

[...]
Mandates:

  • IndexType is a signed or unsigned integer type [...]

This famously excludes char.

Click to expand citation, [basic.fundamental]/1, /2, /7:

There are five standard signed integer types: "signed char", "short int", "int", "long int", and "long long int". [...] The standard and extended signed integer types are collectively called signed integer types.

For each of the standard signed integer types, there exists a corresponding (but different) standard unsigned integer type: "unsigned char", "unsigned short int", "unsigned int", "unsigned long int", and "unsigned long long int". [...] The standard and extended unsigned integer types are collectively called unsigned integer types.

Type char is a distinct type that has an implementation-defined choice of "signed char" or "unsigned char" as its underlying type.

MSVC's STL enforces the Mandates here, so this PR changes the relevant occurrences of char to signed char. To make this work, we also need to add an operator signed char() to the test helper type IntType so it remains unambiguously convertible, and then we can remove operator char().

(libc++ should also enforce the Mandates, [structure.specifications]/3.2, but this PR doesn't attempt to make such a change. I'm not set up to build and test libc++ normally, I just have my exotic configuration.)

…or unsigned integer type"

IntType now needs a conversion.
@StephanTLavavej StephanTLavavej requested a review from a team as a code owner November 27, 2023 16:20
@llvmbot llvmbot added the libc++ libc++ C++ Standard Library. Not GNU libstdc++. Not libc++abi. label Nov 27, 2023
@llvmbot
Copy link
Collaborator

llvmbot commented Nov 27, 2023

@llvm/pr-subscribers-libcxx

Author: Stephan T. Lavavej (StephanTLavavej)

Changes

Found while running libc++'s test suite with MSVC's STL.

N4964 [mdspan.extents.overview]/1.1:

> cpp &gt; template&lt;class IndexType, size_t... Extents&gt; &gt; class extents { &gt;
> [...]
> Mandates:
> * IndexType is a signed or unsigned integer type [...]

This famously excludes char.

<details><summary>Click to expand citation, [basic.fundamental]/1, /2, /7:</summary>

> There are five standard signed integer types: "signed char", "short int", "int", "long int", and "long long int". [...] The standard and extended signed integer types are collectively called signed integer types.

> For each of the standard signed integer types, there exists a corresponding (but different) standard unsigned integer type: "unsigned char", "unsigned short int", "unsigned int", "unsigned long int", and "unsigned long long int". [...] The standard and extended unsigned integer types are collectively called unsigned integer types.

> Type char is a distinct type that has an implementation-defined choice of "signed char" or "unsigned char" as its underlying type.
</details>

MSVC's STL enforces the Mandates here, so this PR changes the relevant occurrences of char to signed char. To make this work, we also need to add an operator signed char() to the test helper type IntType so it remains unambiguously convertible.

(libc++ should also enforce the Mandates, [structure.specifications]/3.2, but this PR doesn't attempt to make such a change. I'm not set up to build and test libc++ normally, I just have my exotic configuration.)


Patch is 32.80 KiB, truncated to 20.00 KiB below, full version: https://github.com/llvm/llvm-project/pull/73535.diff

31 Files Affected:

  • (modified) libcxx/test/std/containers/views/mdspan/ConvertibleToIntegral.h (+1)
  • (modified) libcxx/test/std/containers/views/mdspan/extents/CtorTestCombinations.h (+2-2)
  • (modified) libcxx/test/std/containers/views/mdspan/extents/obs_static.pass.cpp (+1-1)
  • (modified) libcxx/test/std/containers/views/mdspan/extents/types.pass.cpp (+1-1)
  • (modified) libcxx/test/std/containers/views/mdspan/layout_left/extents.verify.cpp (+1-1)
  • (modified) libcxx/test/std/containers/views/mdspan/layout_left/index_operator.pass.cpp (+1-1)
  • (modified) libcxx/test/std/containers/views/mdspan/layout_left/properties.pass.cpp (+1-1)
  • (modified) libcxx/test/std/containers/views/mdspan/layout_left/static_requirements.pass.cpp (+1-1)
  • (modified) libcxx/test/std/containers/views/mdspan/layout_right/extents.verify.cpp (+1-1)
  • (modified) libcxx/test/std/containers/views/mdspan/layout_right/index_operator.pass.cpp (+1-1)
  • (modified) libcxx/test/std/containers/views/mdspan/layout_right/properties.pass.cpp (+1-1)
  • (modified) libcxx/test/std/containers/views/mdspan/layout_right/static_requirements.pass.cpp (+1-1)
  • (modified) libcxx/test/std/containers/views/mdspan/layout_stride/extents.verify.cpp (+1-1)
  • (modified) libcxx/test/std/containers/views/mdspan/layout_stride/index_operator.pass.cpp (+1-1)
  • (modified) libcxx/test/std/containers/views/mdspan/layout_stride/properties.pass.cpp (+2-2)
  • (modified) libcxx/test/std/containers/views/mdspan/layout_stride/static_requirements.pass.cpp (+1-1)
  • (modified) libcxx/test/std/containers/views/mdspan/mdspan/assign.pass.cpp (+2-2)
  • (modified) libcxx/test/std/containers/views/mdspan/mdspan/ctor.copy.pass.cpp (+2-2)
  • (modified) libcxx/test/std/containers/views/mdspan/mdspan/ctor.default.pass.cpp (+3-3)
  • (modified) libcxx/test/std/containers/views/mdspan/mdspan/ctor.dh_array.pass.cpp (+2-2)
  • (modified) libcxx/test/std/containers/views/mdspan/mdspan/ctor.dh_extents.pass.cpp (+2-2)
  • (modified) libcxx/test/std/containers/views/mdspan/mdspan/ctor.dh_integers.pass.cpp (+3-3)
  • (modified) libcxx/test/std/containers/views/mdspan/mdspan/ctor.dh_map.pass.cpp (+2-2)
  • (modified) libcxx/test/std/containers/views/mdspan/mdspan/ctor.dh_map_acc.pass.cpp (+2-2)
  • (modified) libcxx/test/std/containers/views/mdspan/mdspan/ctor.dh_span.pass.cpp (+2-2)
  • (modified) libcxx/test/std/containers/views/mdspan/mdspan/ctor.move.pass.cpp (+2-2)
  • (modified) libcxx/test/std/containers/views/mdspan/mdspan/deduction.pass.cpp (+2-2)
  • (modified) libcxx/test/std/containers/views/mdspan/mdspan/index_operator.pass.cpp (+1-1)
  • (modified) libcxx/test/std/containers/views/mdspan/mdspan/move.pass.cpp (+2-2)
  • (modified) libcxx/test/std/containers/views/mdspan/mdspan/properties.pass.cpp (+2-2)
  • (modified) libcxx/test/std/containers/views/mdspan/mdspan/types.pass.cpp (+3-3)
diff --git a/libcxx/test/std/containers/views/mdspan/ConvertibleToIntegral.h b/libcxx/test/std/containers/views/mdspan/ConvertibleToIntegral.h
index 2f081c38ef65fd5..a9bf3f1513c385d 100644
--- a/libcxx/test/std/containers/views/mdspan/ConvertibleToIntegral.h
+++ b/libcxx/test/std/containers/views/mdspan/ConvertibleToIntegral.h
@@ -18,6 +18,7 @@ struct IntType {
   constexpr operator int() const noexcept { return val; }
   constexpr operator unsigned char() const { return val; }
   constexpr operator char() const noexcept { return val; }
+  constexpr operator signed char() const noexcept { return val; }
 };
 
 // only non-const convertible
diff --git a/libcxx/test/std/containers/views/mdspan/extents/CtorTestCombinations.h b/libcxx/test/std/containers/views/mdspan/extents/CtorTestCombinations.h
index 5ad841f16939a6b..bf08c580f3746ba 100644
--- a/libcxx/test/std/containers/views/mdspan/extents/CtorTestCombinations.h
+++ b/libcxx/test/std/containers/views/mdspan/extents/CtorTestCombinations.h
@@ -89,11 +89,11 @@ constexpr bool test_index_type_combo() {
   test<int, int, Test>();
   test<int, size_t, Test>();
   test<unsigned, int, Test>();
-  test<char, size_t, Test>();
+  test<signed char, size_t, Test>();
   test<long long, unsigned, Test>();
   test<size_t, int, Test>();
   test<size_t, size_t, Test>();
   test<int, IntType, Test>();
-  test<char, IntType, Test>();
+  test<signed char, IntType, Test>();
   return true;
 }
diff --git a/libcxx/test/std/containers/views/mdspan/extents/obs_static.pass.cpp b/libcxx/test/std/containers/views/mdspan/extents/obs_static.pass.cpp
index 90b482b3bc065d7..0c8d3415a672605 100644
--- a/libcxx/test/std/containers/views/mdspan/extents/obs_static.pass.cpp
+++ b/libcxx/test/std/containers/views/mdspan/extents/obs_static.pass.cpp
@@ -81,7 +81,7 @@ void test() {
 int main(int, char**) {
   test<int>();
   test<unsigned>();
-  test<char>();
+  test<signed char>();
   test<long long>();
   test<size_t>();
   return 0;
diff --git a/libcxx/test/std/containers/views/mdspan/extents/types.pass.cpp b/libcxx/test/std/containers/views/mdspan/extents/types.pass.cpp
index 228194533399921..dbaff46e82b6bc6 100644
--- a/libcxx/test/std/containers/views/mdspan/extents/types.pass.cpp
+++ b/libcxx/test/std/containers/views/mdspan/extents/types.pass.cpp
@@ -78,7 +78,7 @@ void test() {
 int main(int, char**) {
   test<int>();
   test<unsigned>();
-  test<char>();
+  test<signed char>();
   test<long long>();
   test<size_t>();
   return 0;
diff --git a/libcxx/test/std/containers/views/mdspan/layout_left/extents.verify.cpp b/libcxx/test/std/containers/views/mdspan/layout_left/extents.verify.cpp
index a1e308f00ae5667..b976ed7295db367 100644
--- a/libcxx/test/std/containers/views/mdspan/layout_left/extents.verify.cpp
+++ b/libcxx/test/std/containers/views/mdspan/layout_left/extents.verify.cpp
@@ -29,5 +29,5 @@ void not_extents() {
 
 void representable() {
   // expected-error-re@*:* {{static assertion failed {{.*}}layout_left::mapping product of static extents must be representable as index_type.}}
-  [[maybe_unused]] std::layout_left::mapping<std::extents<char, 20, 20>> mapping;
+  [[maybe_unused]] std::layout_left::mapping<std::extents<signed char, 20, 20>> mapping;
 }
diff --git a/libcxx/test/std/containers/views/mdspan/layout_left/index_operator.pass.cpp b/libcxx/test/std/containers/views/mdspan/layout_left/index_operator.pass.cpp
index 5ca6f65e510d30d..1b6cb5ab3fb25cf 100644
--- a/libcxx/test/std/containers/views/mdspan/layout_left/index_operator.pass.cpp
+++ b/libcxx/test/std/containers/views/mdspan/layout_left/index_operator.pass.cpp
@@ -80,7 +80,7 @@ constexpr bool test() {
   test_iteration<std::extents<unsigned, D>>(7);
   test_iteration<std::extents<unsigned, 7>>();
   test_iteration<std::extents<unsigned, 7, 8>>();
-  test_iteration<std::extents<char, D, D, D, D>>(1, 1, 1, 1);
+  test_iteration<std::extents<signed char, D, D, D, D>>(1, 1, 1, 1);
 
   // Check operator constraint for number of arguments
   static_assert(check_operator_constraints(std::layout_left::mapping<std::extents<int, D>>(std::extents<int, D>(1)), 0));
diff --git a/libcxx/test/std/containers/views/mdspan/layout_left/properties.pass.cpp b/libcxx/test/std/containers/views/mdspan/layout_left/properties.pass.cpp
index 85a362fc41d2580..cbf1b5c2907663d 100644
--- a/libcxx/test/std/containers/views/mdspan/layout_left/properties.pass.cpp
+++ b/libcxx/test/std/containers/views/mdspan/layout_left/properties.pass.cpp
@@ -53,7 +53,7 @@ constexpr void test_layout_mapping_left() {
 constexpr bool test() {
   constexpr size_t D = std::dynamic_extent;
   test_layout_mapping_left<std::extents<int>>();
-  test_layout_mapping_left<std::extents<char, 4, 5>>();
+  test_layout_mapping_left<std::extents<signed char, 4, 5>>();
   test_layout_mapping_left<std::extents<unsigned, D, 4>>();
   test_layout_mapping_left<std::extents<size_t, D, D, D, D>>();
   return true;
diff --git a/libcxx/test/std/containers/views/mdspan/layout_left/static_requirements.pass.cpp b/libcxx/test/std/containers/views/mdspan/layout_left/static_requirements.pass.cpp
index 366498803a2ded5..23a7c8a09005c13 100644
--- a/libcxx/test/std/containers/views/mdspan/layout_left/static_requirements.pass.cpp
+++ b/libcxx/test/std/containers/views/mdspan/layout_left/static_requirements.pass.cpp
@@ -124,7 +124,7 @@ void test_layout_mapping_left() {
 int main(int, char**) {
   constexpr size_t D = std::dynamic_extent;
   test_layout_mapping_left<std::extents<int>>();
-  test_layout_mapping_left<std::extents<char, 4, 5>>();
+  test_layout_mapping_left<std::extents<signed char, 4, 5>>();
   test_layout_mapping_left<std::extents<unsigned, D, 4>>();
   test_layout_mapping_left<std::extents<size_t, D, D, D, D>>();
   return 0;
diff --git a/libcxx/test/std/containers/views/mdspan/layout_right/extents.verify.cpp b/libcxx/test/std/containers/views/mdspan/layout_right/extents.verify.cpp
index aad91ae6d46f129..c0d1876dca441da 100644
--- a/libcxx/test/std/containers/views/mdspan/layout_right/extents.verify.cpp
+++ b/libcxx/test/std/containers/views/mdspan/layout_right/extents.verify.cpp
@@ -29,5 +29,5 @@ void not_extents() {
 
 void representable() {
   // expected-error-re@*:* {{static assertion failed {{.*}}layout_right::mapping product of static extents must be representable as index_type.}}
-  [[maybe_unused]] std::layout_right::mapping<std::extents<char, 20, 20>> mapping;
+  [[maybe_unused]] std::layout_right::mapping<std::extents<signed char, 20, 20>> mapping;
 }
diff --git a/libcxx/test/std/containers/views/mdspan/layout_right/index_operator.pass.cpp b/libcxx/test/std/containers/views/mdspan/layout_right/index_operator.pass.cpp
index 19072658889eeb2..879e6713376d6c7 100644
--- a/libcxx/test/std/containers/views/mdspan/layout_right/index_operator.pass.cpp
+++ b/libcxx/test/std/containers/views/mdspan/layout_right/index_operator.pass.cpp
@@ -80,7 +80,7 @@ constexpr bool test() {
   test_iteration<std::extents<unsigned, D>>(7);
   test_iteration<std::extents<unsigned, 7>>();
   test_iteration<std::extents<unsigned, 7, 8>>();
-  test_iteration<std::extents<char, D, D, D, D>>(1, 1, 1, 1);
+  test_iteration<std::extents<signed char, D, D, D, D>>(1, 1, 1, 1);
 
   // Check operator constraint for number of arguments
   static_assert(check_operator_constraints(std::layout_right::mapping<std::extents<int, D>>(std::extents<int, D>(1)), 0));
diff --git a/libcxx/test/std/containers/views/mdspan/layout_right/properties.pass.cpp b/libcxx/test/std/containers/views/mdspan/layout_right/properties.pass.cpp
index 26eb2e0fe656192..e10e073c8fb133f 100644
--- a/libcxx/test/std/containers/views/mdspan/layout_right/properties.pass.cpp
+++ b/libcxx/test/std/containers/views/mdspan/layout_right/properties.pass.cpp
@@ -53,7 +53,7 @@ constexpr void test_layout_mapping_right() {
 constexpr bool test() {
   constexpr size_t D = std::dynamic_extent;
   test_layout_mapping_right<std::extents<int>>();
-  test_layout_mapping_right<std::extents<char, 4, 5>>();
+  test_layout_mapping_right<std::extents<signed char, 4, 5>>();
   test_layout_mapping_right<std::extents<unsigned, D, 4>>();
   test_layout_mapping_right<std::extents<size_t, D, D, D, D>>();
   return true;
diff --git a/libcxx/test/std/containers/views/mdspan/layout_right/static_requirements.pass.cpp b/libcxx/test/std/containers/views/mdspan/layout_right/static_requirements.pass.cpp
index d460f1a5dbc468a..c4e3d89cb94f46d 100644
--- a/libcxx/test/std/containers/views/mdspan/layout_right/static_requirements.pass.cpp
+++ b/libcxx/test/std/containers/views/mdspan/layout_right/static_requirements.pass.cpp
@@ -124,7 +124,7 @@ void test_layout_mapping_right() {
 int main(int, char**) {
   constexpr size_t D = std::dynamic_extent;
   test_layout_mapping_right<std::extents<int>>();
-  test_layout_mapping_right<std::extents<char, 4, 5>>();
+  test_layout_mapping_right<std::extents<signed char, 4, 5>>();
   test_layout_mapping_right<std::extents<unsigned, D, 4>>();
   test_layout_mapping_right<std::extents<size_t, D, D, D, D>>();
   return 0;
diff --git a/libcxx/test/std/containers/views/mdspan/layout_stride/extents.verify.cpp b/libcxx/test/std/containers/views/mdspan/layout_stride/extents.verify.cpp
index 46f2b774bcbd9fd..0c2ec888ab35bc9 100644
--- a/libcxx/test/std/containers/views/mdspan/layout_stride/extents.verify.cpp
+++ b/libcxx/test/std/containers/views/mdspan/layout_stride/extents.verify.cpp
@@ -29,5 +29,5 @@ void not_extents() {
 
 void representable() {
   // expected-error-re@*:* {{static assertion failed {{.*}}layout_stride::mapping product of static extents must be representable as index_type.}}
-  [[maybe_unused]] std::layout_stride::mapping<std::extents<char, 20, 20>> mapping;
+  [[maybe_unused]] std::layout_stride::mapping<std::extents<signed char, 20, 20>> mapping;
 }
diff --git a/libcxx/test/std/containers/views/mdspan/layout_stride/index_operator.pass.cpp b/libcxx/test/std/containers/views/mdspan/layout_stride/index_operator.pass.cpp
index dbd56a54758c97c..01278e9076714a9 100644
--- a/libcxx/test/std/containers/views/mdspan/layout_stride/index_operator.pass.cpp
+++ b/libcxx/test/std/containers/views/mdspan/layout_stride/index_operator.pass.cpp
@@ -79,7 +79,7 @@ constexpr bool test() {
   test_iteration<std::extents<unsigned, D>>(std::array<int, 1>{3}, 7);
   test_iteration<std::extents<unsigned, 7>>(std::array<int, 1>{4});
   test_iteration<std::extents<unsigned, 7, 8>>(std::array<int, 2>{25, 3});
-  test_iteration<std::extents<char, D, D, D, D>>(std::array<int, 4>{1, 1, 1, 1}, 1, 1, 1, 1);
+  test_iteration<std::extents<signed char, D, D, D, D>>(std::array<int, 4>{1, 1, 1, 1}, 1, 1, 1, 1);
 
   // Check operator constraint for number of arguments
   static_assert(check_operator_constraints(
diff --git a/libcxx/test/std/containers/views/mdspan/layout_stride/properties.pass.cpp b/libcxx/test/std/containers/views/mdspan/layout_stride/properties.pass.cpp
index d3d0aa6b3c3a538..8dba35cd9d33666 100644
--- a/libcxx/test/std/containers/views/mdspan/layout_stride/properties.pass.cpp
+++ b/libcxx/test/std/containers/views/mdspan/layout_stride/properties.pass.cpp
@@ -102,8 +102,8 @@ test_layout_mapping_stride(E ext, std::array<typename E::index_type, E::rank()>
 constexpr bool test() {
   constexpr size_t D = std::dynamic_extent;
   test_layout_mapping_stride(std::extents<int>(), std::array<int, 0>{}, true);
-  test_layout_mapping_stride(std::extents<char, 4, 5>(), std::array<char, 2>{1, 4}, true);
-  test_layout_mapping_stride(std::extents<char, 4, 5>(), std::array<char, 2>{1, 5}, false);
+  test_layout_mapping_stride(std::extents<signed char, 4, 5>(), std::array<signed char, 2>{1, 4}, true);
+  test_layout_mapping_stride(std::extents<signed char, 4, 5>(), std::array<signed char, 2>{1, 5}, false);
   test_layout_mapping_stride(std::extents<unsigned, D, 4>(7), std::array<unsigned, 2>{20, 2}, false);
   test_layout_mapping_stride(std::extents<size_t, D, D, D, D>(3, 3, 3, 3), std::array<size_t, 4>{3, 1, 9, 27}, true);
   return true;
diff --git a/libcxx/test/std/containers/views/mdspan/layout_stride/static_requirements.pass.cpp b/libcxx/test/std/containers/views/mdspan/layout_stride/static_requirements.pass.cpp
index b56d0087260d1fc..8c5bf16b37c1e1f 100644
--- a/libcxx/test/std/containers/views/mdspan/layout_stride/static_requirements.pass.cpp
+++ b/libcxx/test/std/containers/views/mdspan/layout_stride/static_requirements.pass.cpp
@@ -124,7 +124,7 @@ void test_layout_mapping_stride() {
 int main(int, char**) {
   constexpr size_t D = std::dynamic_extent;
   test_layout_mapping_stride<std::extents<int>>();
-  test_layout_mapping_stride<std::extents<char, 4, 5>>();
+  test_layout_mapping_stride<std::extents<signed char, 4, 5>>();
   test_layout_mapping_stride<std::extents<unsigned, D, 4>>();
   test_layout_mapping_stride<std::extents<size_t, D, D, D, D>>();
   return 0;
diff --git a/libcxx/test/std/containers/views/mdspan/mdspan/assign.pass.cpp b/libcxx/test/std/containers/views/mdspan/mdspan/assign.pass.cpp
index 8741c79315f1e87..b282277d0dc0699 100644
--- a/libcxx/test/std/containers/views/mdspan/mdspan/assign.pass.cpp
+++ b/libcxx/test/std/containers/views/mdspan/mdspan/assign.pass.cpp
@@ -57,10 +57,10 @@ template <class H, class L, class A>
 constexpr void mixin_extents(const H& handle, const L& layout, const A& acc) {
   constexpr size_t D = std::dynamic_extent;
   test_mdspan_types(handle, construct_mapping(layout, std::extents<int>()), acc);
-  test_mdspan_types(handle, construct_mapping(layout, std::extents<char, D>(7)), acc);
+  test_mdspan_types(handle, construct_mapping(layout, std::extents<signed char, D>(7)), acc);
   test_mdspan_types(handle, construct_mapping(layout, std::extents<unsigned, 7>()), acc);
   test_mdspan_types(handle, construct_mapping(layout, std::extents<size_t, D, 4, D>(2, 3)), acc);
-  test_mdspan_types(handle, construct_mapping(layout, std::extents<char, D, 7, D>(0, 3)), acc);
+  test_mdspan_types(handle, construct_mapping(layout, std::extents<signed char, D, 7, D>(0, 3)), acc);
   test_mdspan_types(handle, construct_mapping(layout, std::extents<int64_t, D, 7, D, 4, D, D>(1, 2, 3, 2)), acc);
 }
 
diff --git a/libcxx/test/std/containers/views/mdspan/mdspan/ctor.copy.pass.cpp b/libcxx/test/std/containers/views/mdspan/mdspan/ctor.copy.pass.cpp
index 7fb85ed845d6cbc..75f2fc3dd603a2f 100644
--- a/libcxx/test/std/containers/views/mdspan/mdspan/ctor.copy.pass.cpp
+++ b/libcxx/test/std/containers/views/mdspan/mdspan/ctor.copy.pass.cpp
@@ -47,10 +47,10 @@ template <class H, class L, class A>
 constexpr void mixin_extents(const H& handle, const L& layout, const A& acc) {
   constexpr size_t D = std::dynamic_extent;
   test_mdspan_types(handle, construct_mapping(layout, std::extents<int>()), acc);
-  test_mdspan_types(handle, construct_mapping(layout, std::extents<char, D>(7)), acc);
+  test_mdspan_types(handle, construct_mapping(layout, std::extents<signed char, D>(7)), acc);
   test_mdspan_types(handle, construct_mapping(layout, std::extents<unsigned, 7>()), acc);
   test_mdspan_types(handle, construct_mapping(layout, std::extents<size_t, D, 4, D>(2, 3)), acc);
-  test_mdspan_types(handle, construct_mapping(layout, std::extents<char, D, 7, D>(0, 3)), acc);
+  test_mdspan_types(handle, construct_mapping(layout, std::extents<signed char, D, 7, D>(0, 3)), acc);
   test_mdspan_types(handle, construct_mapping(layout, std::extents<int64_t, D, 7, D, 4, D, D>(1, 2, 3, 2)), acc);
 }
 
diff --git a/libcxx/test/std/containers/views/mdspan/mdspan/ctor.default.pass.cpp b/libcxx/test/std/containers/views/mdspan/mdspan/ctor.default.pass.cpp
index 8ad12944df84d4b..2e2a243355e40a1 100644
--- a/libcxx/test/std/containers/views/mdspan/mdspan/ctor.default.pass.cpp
+++ b/libcxx/test/std/containers/views/mdspan/mdspan/ctor.default.pass.cpp
@@ -59,10 +59,10 @@ template <bool hc, bool mc, bool ac, class H, class L, class A>
 constexpr void mixin_extents(const H& handle, const L& layout, const A& acc) {
   constexpr size_t D = std::dynamic_extent;
   test_mdspan_types<hc, mc, ac>(handle, construct_mapping(layout, std::extents<int>()), acc);
-  test_mdspan_types<hc, mc, ac>(handle, construct_mapping(layout, std::extents<char, D>(7)), acc);
+  test_mdspan_types<hc, mc, ac>(handle, construct_mapping(layout, std::extents<signed char, D>(7)), acc);
   test_mdspan_types<hc, mc, ac>(handle, construct_mapping(layout, std::extents<unsigned, 7>()), acc);
   test_mdspan_types<hc, mc, ac>(handle, construct_mapping(layout, std::extents<size_t, D, 4, D>(2, 3)), acc);
-  test_mdspan_types<hc, mc, ac>(handle, construct_mapping(layout, std::extents<char, D, 7, D>(0, 3)), acc);
+  test_mdspan_types<hc, mc, ac>(handle, construct_mapping(layout, std::extents<signed char, D, 7, D>(0, 3)), acc);
   test_mdspan_types<hc, mc, ac>(
       handle, construct_mapping(layout, std::extents<int64_t, D, 7, D, 4, D, D>(1, 2, 3, 2)), acc);
 }
@@ -75,7 +75,7 @@ constexpr void mixin_layout(const H& handle, const A& acc) {
   // Use weird layout, make sure it has the properties we want to test
   constexpr size_t D = std::dynamic_extent;
   static_assert(
-      !std::is_default_constructible_v< typename layout_wrapping_integral<4>::template mapping<std::extents<char, D>>>);
+      !std::is_default_constructible_v< typename layout_wrapping_integral<4>::template mapping<std::extents<signed char, D>>>);
   mixin_extents<hc, false, ac>(handle, layout_wrapping_integral<4>(), acc);
 }
 
diff --git a/libcxx/test/std/containers/views/mdspan/mdspan/ctor.dh_array.pass.cpp b/libcxx/test/std/containers/views/mdspan/mdspan/ctor.dh_array.pass.cpp
index 3c8797c023e1b57..2e5c842b50d4515 100644
--- a/libcxx/test/std/containers/views/mdspan/mdspan/ctor.dh_array.pass.cpp
+++ b/libcxx/test/std/containers/views/mdspan/mdspan/ctor.dh_array.pass.cpp
@@ -105,10 +105,10 @@ template <bool mec, bool ac, class H, class L, class A>
 constexpr void mixin_extents(const H& handle, const L& layout, const A& acc) {
   constexpr size_t D = std::dynamic_extent;
   test_mdspan_ctor<mec, ac>(handle, construct_mapping(layout, std::extents<int>()), acc);
-  test_mdspan_ctor<mec, ac>(handle, construct_mapping(layout, std::extents<char, D>(7)), acc);
+  test_mdspan_ctor<mec, ac>(handle, construct_mapping(layout, std::extents<signed char, D>(7)), acc);
   test_mdspan_ctor<mec, ac>(handle, construct_mapping(layout, std::extents<unsigned, 7>()), acc);
   test_mdspan_ctor<mec, ac>(handle, construct_mapping(layout, std::extents<size_t, D, 4, D>(2, 3)), acc);
-  test_mdspan_ctor<mec, ac>(handle, construct_mapping(layout, std::extents<char, D, 7, D>(0, 3)), acc);
+  test_mdspan_ctor<mec, ac>(handle, construct_mapping(layout, std::extents<signed char, D, 7, D>(0, 3)), acc);
   test_mdspan_ctor<mec, ac>(
       handle, construct_mapping(layout, std::extents<int64_t, D, 7, D, 4, D, D>(1, 2, 3, 2)), acc);
 }
diff --git a/libcxx/test/std/containers/views/mdspan/mdspan/ctor.dh_extents.pass.cpp b/libcxx/test/std/containers/views/mdspan/mdspan/ctor.dh_extents.pass.cpp
index 37ee8bdc2e1af4e..007ab9cdc636d56 100644
--- a/libcxx/test/std/containers/views/mdspan/mdspan/ctor.dh_extents.pass.cpp
+++ b/libcxx/test/std/containers/views/mdspan/mdspan/ctor.dh_extents.pass.cpp
@@ -68,10 +68,10 @@ template <bool mec, bool ac, class H, class L, class A>
 constexpr void mixin_extents(const H& handle, const L& layout, const A& acc) {
   constexpr size_t D = std::dynamic_extent;
   test_mdspan_types<mec, ac>(handle, construct_mapping(layout, std::extents<int>()), acc);
-  test_mdspan_types<mec, ac>(handle, construct_mapping(layout, std::extents<char, D>(7)), acc);
+  test_mdspan_types<mec, ac>(handle, construct_mapping(layout, std::extents<signed char, D>(7)), acc);
   test_mdspan_types<mec, ac>(handle, construct_mapping(layout, std::extents<unsigned, 7>()), acc);
   test_mdspan_types<mec, ac>(handle, construct_mapping(layout, std::extents<size_t, D, 4, D>(2, 3)), acc);
-  test_mdspan_types<mec, ac>(handle, construct_mapping(layout, std::extents<char, D, 7, D>(0, 3)), acc);
+  test_mdspan_types<mec, ac>(handle, construct_mapping(layout, std::extents<signed char, D, 7, D>(0, 3)), acc);
   test_mdspan_types<mec, ac>(
       handle, construct_mapping(layout, std::extents<int64_t, D, 7, D, 4, D, D>(1, 2, 3, 2)), acc);
 }
diff --git a/libcxx/test/std/containers/views/mdspan/mdspan/ctor.dh_integers.pass.cpp b/libcxx/test/std/containers/views/mdspan/mdspan/ctor.dh_integers.pass.cpp
index f4a3e8adc40d8ea..985a8911e15b6e3 100644
--- a/libcxx/test/std/containers...
[truncated]

Copy link

github-actions bot commented Nov 27, 2023

✅ With the latest revision this PR passed the C/C++ code formatter.

@ldionne
Copy link
Member

ldionne commented Nov 27, 2023

@crtrott Can you follow-up on adding a static_assert for the mandate? We should do this sooner rather than later since it'll prevent people from starting to rely on this.

@ldionne ldionne merged commit ab56268 into llvm:main Nov 28, 2023
36 of 39 checks passed
@StephanTLavavej StephanTLavavej deleted the stl-6-extents-char branch November 28, 2023 23:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
libc++ libc++ C++ Standard Library. Not GNU libstdc++. Not libc++abi.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants