Files
libcxx/test/std/utilities/function.objects/unord.hash/non_enum.pass.cpp
Zhihao Yuan e445521637 [libcxx] P0604, invoke_result and is_invocable
Summary:
Introduce a new form of `result_of` without function type encoding.

Rename and split `is_callable/is_nothrow_callable` into `is_invocable/is_nothrow_invocable/is_invocable_r/is_nothrow_invocable_r` (and associated types accordingly)

Change function type encoding of previous `is_callable/is_nothrow_callable` traits to conventional template type parameter lists.


Reviewers: EricWF, mclow.lists, bebuch

Reviewed By: EricWF, bebuch

Subscribers: lichray, bebuch, cfe-commits

Differential Revision: https://reviews.llvm.org/D38831

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@320509 91177308-0d34-0410-b5e6-96231b3b80d8
2017-12-12 18:42:04 +00:00

39 lines
1.2 KiB
C++

//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is dual licensed under the MIT and the University of Illinois Open
// Source Licenses. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// UNSUPPORTED: c++98, c++03, c++11
// <functional>
// Hashing a struct w/o a defined hash should *not* fail, but it should
// create a type that is not constructible and not callable.
// See also: https://cplusplus.github.io/LWG/lwg-defects.html#2543
#include <functional>
#include <cassert>
#include <type_traits>
#include "test_macros.h"
struct X {};
int main()
{
using H = std::hash<X>;
static_assert(!std::is_default_constructible<H>::value, "");
static_assert(!std::is_copy_constructible<H>::value, "");
static_assert(!std::is_move_constructible<H>::value, "");
static_assert(!std::is_copy_assignable<H>::value, "");
static_assert(!std::is_move_assignable<H>::value, "");
#if TEST_STD_VER > 14
static_assert(!std::is_invocable<H, X&>::value, "");
static_assert(!std::is_invocable<H, X const&>::value, "");
#endif
}