[MemProf] Templatize CallStackRadixTreeBuilder (NFC) (#117014)
[llvm-project.git] / libcxx / test / std / containers / views / mdspan / default_accessor / ctor.default.pass.cpp
blob28bd7c0fcb2b15f9fe1fdb5eecc27ef197f733b3
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 //===----------------------------------------------------------------------===//
9 // UNSUPPORTED: c++03, c++11, c++14, c++17, c++20
11 // <mdspan>
13 // Test default construction:
15 // constexpr default_accessor() noexcept = default;
17 #include <mdspan>
18 #include <cassert>
19 #include <cstdint>
20 #include <type_traits>
22 #include "test_macros.h"
24 #include "../MinimalElementType.h"
26 template <class T>
27 constexpr void test_construction() {
28 ASSERT_NOEXCEPT(std::default_accessor<T>{});
29 [[maybe_unused]] std::default_accessor<T> acc;
30 static_assert(std::is_trivially_default_constructible_v<std::default_accessor<T>>);
33 constexpr bool test() {
34 test_construction<int>();
35 test_construction<const int>();
36 test_construction<MinimalElementType>();
37 test_construction<const MinimalElementType>();
38 return true;
41 int main(int, char**) {
42 test();
43 static_assert(test());
44 return 0;