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