xref: /llvm-project/libcxx/test/std/containers/views/mdspan/layout_left/extents.verify.cpp (revision ab562686d1d67962576b7a01346d9ff691b6b28d)
1b4ff8938SChristian Trott //===----------------------------------------------------------------------===//
2b4ff8938SChristian Trott //
3b4ff8938SChristian Trott // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4b4ff8938SChristian Trott // See https://llvm.org/LICENSE.txt for license information.
5b4ff8938SChristian Trott // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6b4ff8938SChristian Trott //
7b4ff8938SChristian Trott //===----------------------------------------------------------------------===//
8b4ff8938SChristian Trott 
9b4ff8938SChristian Trott // UNSUPPORTED: c++03, c++11, c++14, c++17, c++20
10b4ff8938SChristian Trott 
11b4ff8938SChristian Trott // <mdspan>
12b4ff8938SChristian Trott 
13b4ff8938SChristian Trott // template<class Extents>
14b4ff8938SChristian Trott // class layout_left::mapping;
15b4ff8938SChristian Trott 
16b4ff8938SChristian Trott // If Extents is not a specialization of extents, then the program is
17b4ff8938SChristian Trott // ill-formed.
18b4ff8938SChristian Trott 
19b4ff8938SChristian Trott // Mandates: If Extents::rank_dynamic() == 0 is true, then the size of the
20b4ff8938SChristian Trott // multidimensional index space Extents() is representable as a value of type
21b4ff8938SChristian Trott // typename Extents::index_type.
22b4ff8938SChristian Trott 
23b4ff8938SChristian Trott #include <mdspan>
24b4ff8938SChristian Trott 
not_extents()25b4ff8938SChristian Trott void not_extents() {
269bb9ec38SLouis Dionne   // expected-error-re@*:* {{static assertion failed {{.*}}layout_left::mapping template argument must be a specialization of extents}}
27b4ff8938SChristian Trott   [[maybe_unused]] std::layout_left::mapping<void> mapping;
28b4ff8938SChristian Trott }
29b4ff8938SChristian Trott 
representable()30b4ff8938SChristian Trott void representable() {
319bb9ec38SLouis Dionne   // expected-error-re@*:* {{static assertion failed {{.*}}layout_left::mapping product of static extents must be representable as index_type.}}
32*ab562686SStephan T. Lavavej   [[maybe_unused]] std::layout_left::mapping<std::extents<signed char, 20, 20>> mapping;
33b4ff8938SChristian Trott }
34