//===----------------------------------------------------------------------===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// // ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DISABLE_DEPRECATION_WARNINGS // // template // struct hash // : public unary_function // { // size_t operator()(T val) const; // }; // XFAIL: FROZEN-CXX03-HEADERS-FIXME // Not very portable #include #include #include #include #include "test_macros.h" template void test() { typedef std::hash H; #if TEST_STD_VER <= 17 static_assert((std::is_same::value), ""); static_assert((std::is_same::value), ""); #endif ASSERT_NOEXCEPT(H()(T())); H h; typedef typename std::remove_pointer::type type; type i; type j; assert(h(&i) != h(&j)); } void test_nullptr() { typedef std::nullptr_t T; typedef std::hash H; #if TEST_STD_VER <= 17 static_assert((std::is_same::value), ""); static_assert((std::is_same::value), ""); #endif ASSERT_NOEXCEPT(H()(T())); } int main(int, char**) { test(); test_nullptr(); return 0; }