1 | //===----------------------------------------------------------------------===// |
2 | // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. |
3 | // See https://llvm.org/LICENSE.txt for license information. |
4 | // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception |
5 | // |
6 | //===----------------------------------------------------------------------===// |
7 | |
8 | // UNSUPPORTED: c++03, c++11, c++14, c++17, c++20 |
9 | |
10 | // <format> |
11 | |
12 | // template<ranges::input_range R> |
13 | // requires same_as<R, remove_cvref_t<R>> |
14 | // constexpr range_format format_kind<R> = see below; |
15 | |
16 | #include <format> |
17 | |
18 | #include <array> |
19 | #include <queue> |
20 | #include <stack> |
21 | #include <tuple> |
22 | #include <utility> |
23 | |
24 | #include "test_macros.h" |
25 | |
26 | constexpr std::range_format valid = std::format_kind<std::array<int, 1>>; |
27 | |
28 | // expected-error@*:* {{create a template specialization of format_kind for your type}} |
29 | constexpr std::range_format invalid_due_to_const = std::format_kind<const std::array<int, 1>>; |
30 | |
31 | // expected-error@*:* {{create a template specialization of format_kind for your type}} |
32 | constexpr std::range_format invalid_due_to_volatile = std::format_kind<volatile std::array<int, 1>>; |
33 | |
34 | // expected-error@*:* {{create a template specialization of format_kind for your type}} |
35 | constexpr std::range_format invalid_due_to_reference = std::format_kind<std::array<int, 1>&>; |
36 | |
37 | // expected-error@*:* {{create a template specialization of format_kind for your type}} |
38 | constexpr std::range_format invalid_no_input_range = std::format_kind<int>; |
39 | |
40 | // expected-error@*:* {{create a template specialization of format_kind for your type}} |
41 | constexpr std::range_format not_a_range_stack = std::format_kind<std::stack<int>>; |
42 | |
43 | // expected-error@*:* {{create a template specialization of format_kind for your type}} |
44 | constexpr std::range_format not_a_range_queue = std::format_kind<std::queue<int>>; |
45 | |
46 | // expected-error@*:* {{create a template specialization of format_kind for your type}} |
47 | constexpr std::range_format not_a_range_priority_queue = std::format_kind<std::priority_queue<int>>; |
48 | |
49 | // expected-error@*:* {{create a template specialization of format_kind for your type}} |
50 | constexpr std::range_format not_a_range_pair = std::format_kind<std::pair<int, int>>; |
51 | |
52 | // expected-error@*:* {{create a template specialization of format_kind for your type}} |
53 | constexpr std::range_format not_a_range_tuple_1 = std::format_kind<std::tuple<int>>; |
54 | |
55 | // expected-error@*:* {{create a template specialization of format_kind for your type}} |
56 | constexpr std::range_format not_a_range_tuple_2 = std::format_kind<std::tuple<int, int>>; |
57 | |
58 | // expected-error@*:* {{create a template specialization of format_kind for your type}} |
59 | constexpr std::range_format not_a_range_tuple_3 = std::format_kind<std::tuple<int, int, int>>; |
60 | |