[gn build] Port 0154dce8d39d
[llvm-project.git] / libcxx / test / std / experimental / utilities / propagate_const / propagate_const.nonmembers / hash.pass.cpp
blobfb0c607b73de0aac7cf5cdc4b93016418164c74a
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
11 // <propagate_const>
13 // template <class T> struct hash<experimental::fundamentals_v2::propagate_const<T>>;
15 #include <experimental/propagate_const>
16 #include <cassert>
17 #include <cstddef>
18 #include <functional>
20 #include "test_macros.h"
21 #include "propagate_const_helpers.h"
23 using std::experimental::propagate_const;
25 template <>
26 struct std::hash<X> {
27 typedef X first_argument_type;
29 std::size_t operator()(const first_argument_type&) const { return 99; }
32 int main(int, char**) {
34 typedef propagate_const<X> P;
36 P p(1);
38 auto h = std::hash<P>();
40 assert(h(p)==99);
42 return 0;