//===----------------------------------------------------------------------===// // // 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 // //===----------------------------------------------------------------------===// // // UNSUPPORTED: c++03 // // // // result_of // ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_ENABLE_CXX20_REMOVED_TYPE_TRAITS // ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DISABLE_DEPRECATION_WARNINGS #include #include #include #include #include "test_macros.h" // Ignore warnings about volatile in parameters being deprecated. // We know it is, but we still have to test it. TEST_CLANG_DIAGNOSTIC_IGNORED("-Wdeprecated-volatile") TEST_GCC_DIAGNOSTIC_IGNORED("-Wvolatile") // MSVC warning C5215: a function parameter with a volatile qualified type is deprecated in C++20 TEST_MSVC_DIAGNOSTIC_IGNORED(5215) struct wat { wat& operator*() { return *this; } void foo(); }; struct F {}; struct FD : public F {}; #if TEST_STD_VER > 14 template struct test_invoke_result; template struct test_invoke_result { static void call() { static_assert(std::is_invocable::value, ""); static_assert(std::is_invocable_r::value, ""); ASSERT_SAME_TYPE(Ret, typename std::invoke_result::type); ASSERT_SAME_TYPE(Ret, std::invoke_result_t); } }; #endif template void test_result_of_imp() { ASSERT_SAME_TYPE(U, typename std::result_of::type); #if TEST_STD_VER > 11 ASSERT_SAME_TYPE(U, std::result_of_t); #endif #if TEST_STD_VER > 14 test_invoke_result::call(); #endif } int main(int, char**) { { typedef char F::*PMD; test_result_of_imp(); test_result_of_imp(); test_result_of_imp(); test_result_of_imp(); test_result_of_imp(); test_result_of_imp(); test_result_of_imp(); test_result_of_imp(); test_result_of_imp(); test_result_of_imp(); test_result_of_imp(); test_result_of_imp(); test_result_of_imp(); test_result_of_imp(); test_result_of_imp(); test_result_of_imp(); test_result_of_imp(); test_result_of_imp(); test_result_of_imp(); test_result_of_imp(); test_result_of_imp(); test_result_of_imp(); test_result_of_imp(); test_result_of_imp(); test_result_of_imp), char &>(); test_result_of_imp), const char &>(); test_result_of_imp), char &>(); test_result_of_imp), const char &>(); test_result_of_imp), char &>(); test_result_of_imp), const char &>(); test_result_of_imp), char &>(); test_result_of_imp), const char &>(); } { test_result_of_imp (); test_result_of_imp (); test_result_of_imp (); test_result_of_imp (); test_result_of_imp (); test_result_of_imp (); test_result_of_imp (); test_result_of_imp (); test_result_of_imp (); test_result_of_imp (); test_result_of_imp (); test_result_of_imp (); test_result_of_imp (); test_result_of_imp (); test_result_of_imp (); test_result_of_imp (); test_result_of_imp (); test_result_of_imp (); test_result_of_imp (); test_result_of_imp (); test_result_of_imp (); test_result_of_imp (); test_result_of_imp (); test_result_of_imp (); test_result_of_imp (); test_result_of_imp (); test_result_of_imp (); } { test_result_of_imp (); test_result_of_imp (); test_result_of_imp (); test_result_of_imp (); test_result_of_imp (); test_result_of_imp (); test_result_of_imp (); test_result_of_imp (); test_result_of_imp (); test_result_of_imp (); test_result_of_imp (); test_result_of_imp (); test_result_of_imp (); test_result_of_imp (); test_result_of_imp (); test_result_of_imp (); test_result_of_imp (); test_result_of_imp (); test_result_of_imp (); test_result_of_imp (); test_result_of_imp (); test_result_of_imp (); test_result_of_imp (); test_result_of_imp (); test_result_of_imp (); test_result_of_imp (); test_result_of_imp (); } { test_result_of_imp)) (), int>(); test_result_of_imp)) () const, int>(); test_result_of_imp )) (), int>(); test_result_of_imp )) () const, int>(); } test_result_of_imp(); return 0; }