| 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 | // <format> |
| 12 | |
| 13 | // template<ranges::input_range R> |
| 14 | // requires same_as<R, remove_cvref_t<R>> |
| 15 | // constexpr range_format format_kind<R> = see below; |
| 16 | |
| 17 | #include <format> |
| 18 | |
| 19 | #include <array> |
| 20 | #include <queue> |
| 21 | #include <stack> |
| 22 | #include <tuple> |
| 23 | #include <utility> |
| 24 | |
| 25 | #include "test_macros.h" |
| 26 | |
| 27 | constexpr std::range_format valid = std::format_kind<std::array<int, 1>>; |
| 28 | |
| 29 | // expected-error@*:* {{create a template specialization of format_kind for your type}} |
| 30 | constexpr std::range_format invalid_due_to_const = std::format_kind<const std::array<int, 1>>; |
| 31 | |
| 32 | // expected-error@*:* {{create a template specialization of format_kind for your type}} |
| 33 | constexpr std::range_format invalid_due_to_volatile = std::format_kind<volatile std::array<int, 1>>; |
| 34 | |
| 35 | // expected-error@*:* {{create a template specialization of format_kind for your type}} |
| 36 | constexpr std::range_format invalid_due_to_reference = std::format_kind<std::array<int, 1>&>; |
| 37 | |
| 38 | // expected-error@*:* {{create a template specialization of format_kind for your type}} |
| 39 | constexpr std::range_format invalid_no_input_range = std::format_kind<int>; |
| 40 | |
| 41 | // expected-error@*:* {{create a template specialization of format_kind for your type}} |
| 42 | constexpr std::range_format not_a_range_stack = std::format_kind<std::stack<int>>; |
| 43 | |
| 44 | // expected-error@*:* {{create a template specialization of format_kind for your type}} |
| 45 | constexpr std::range_format not_a_range_queue = std::format_kind<std::queue<int>>; |
| 46 | |
| 47 | // expected-error@*:* {{create a template specialization of format_kind for your type}} |
| 48 | constexpr std::range_format not_a_range_priority_queue = std::format_kind<std::priority_queue<int>>; |
| 49 | |
| 50 | // expected-error@*:* {{create a template specialization of format_kind for your type}} |
| 51 | constexpr std::range_format not_a_range_pair = std::format_kind<std::pair<int, int>>; |
| 52 | |
| 53 | // expected-error@*:* {{create a template specialization of format_kind for your type}} |
| 54 | constexpr std::range_format not_a_range_tuple_1 = std::format_kind<std::tuple<int>>; |
| 55 | |
| 56 | // expected-error@*:* {{create a template specialization of format_kind for your type}} |
| 57 | constexpr std::range_format not_a_range_tuple_2 = std::format_kind<std::tuple<int, int>>; |
| 58 | |
| 59 | // expected-error@*:* {{create a template specialization of format_kind for your type}} |
| 60 | constexpr std::range_format not_a_range_tuple_3 = std::format_kind<std::tuple<int, int, int>>; |
| 61 | |