| 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 | // REQUIRES: std-at-least-c++17 |
| 10 | |
| 11 | #include <variant> |
| 12 | |
| 13 | #include "test_macros.h" |
| 14 | |
| 15 | using A1 [[maybe_unused]] = std::hash<std::variant<int, long>>::argument_type; |
| 16 | using R1 [[maybe_unused]] = std::hash<std::variant<int, long>>::result_type; |
| 17 | #if TEST_STD_VER >= 20 |
| 18 | // expected-error@-3 {{no type named 'argument_type' in 'std::hash<std::variant<int, long>>'}} |
| 19 | // expected-error@-3 {{no type named 'result_type' in 'std::hash<std::variant<int, long>>'}} |
| 20 | #else |
| 21 | // expected-warning@-6 {{'argument_type' is deprecated}} |
| 22 | // expected-warning@-6 {{'result_type' is deprecated}} |
| 23 | #endif |
| 24 | |
| 25 | using A2 [[maybe_unused]] = std::hash<std::monostate>::argument_type; |
| 26 | using R2 [[maybe_unused]] = std::hash<std::monostate>::result_type; |
| 27 | #if TEST_STD_VER >= 20 |
| 28 | // expected-error@-3 {{no type named 'argument_type' in 'std::hash<monostate>'}} |
| 29 | // expected-error@-3 {{no type named 'result_type' in 'std::hash<monostate>'}} |
| 30 | #else |
| 31 | // expected-warning@-6 {{'argument_type' is deprecated}} |
| 32 | // expected-warning@-6 {{'result_type' is deprecated}} |
| 33 | #endif |
| 34 | |