| 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 |
| 10 | |
| 11 | // <propagate_const> |
| 12 | |
| 13 | // template <class T> struct hash<experimental::fundamentals_v2::propagate_const<T>>; |
| 14 | |
| 15 | #include <experimental/propagate_const> |
| 16 | #include <cassert> |
| 17 | #include <cstddef> |
| 18 | #include <functional> |
| 19 | |
| 20 | #include "test_macros.h" |
| 21 | #include "propagate_const_helpers.h" |
| 22 | |
| 23 | using std::experimental::propagate_const; |
| 24 | |
| 25 | template <> |
| 26 | struct std::hash<X> { |
| 27 | typedef X first_argument_type; |
| 28 | |
| 29 | std::size_t operator()(const first_argument_type&) const { return 99; } |
| 30 | }; |
| 31 | |
| 32 | int main(int, char**) { |
| 33 | |
| 34 | typedef propagate_const<X> P; |
| 35 | |
| 36 | P p(1); |
| 37 | |
| 38 | auto h = std::hash<P>(); |
| 39 | |
| 40 | assert(h(p)==99); |
| 41 | |
| 42 | return 0; |
| 43 | } |
| 44 | |