[libcxx-commits] [libcxx] [libc++] Disallow character types being index types of `extents` (PR #105832)
Nikolas Klauser via libcxx-commits
libcxx-commits at lists.llvm.org
Tue Aug 27 13:45:25 PDT 2024
================
@@ -0,0 +1,49 @@
+//
+// 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, c++20
+
+// <mdspan>
+
+// template<class IndexType, size_t... Extents>
+// class extents;
+//
+// Mandates:
+// - IndexType is a signed or unsigned integer type, and
+// - each element of Extents is either equal to dynamic_extent, or is representable as a value of type IndexType.
+
+#include <cstddef>
+#include <climits>
+#include <mdspan>
+
+void invalid_index_types() {
+ // expected-error-re@*:* {{static assertion failed {{.*}}extents::index_type must be a signed or unsigned integer type}}
+ [[maybe_unused]] std::extents<char, '*'> ec;
----------------
philnik777 wrote:
I'd still like to see this addressed.
https://github.com/llvm/llvm-project/pull/105832
More information about the libcxx-commits
mailing list