//===----------------------------------------------------------------------===// // // 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. // //===----------------------------------------------------------------------===// // // result_of #include #include typedef bool (&PF1)(); typedef short (*PF2)(long); struct S { operator PF2() const; double operator()(char, int&); void calc(long) const; char data_; }; typedef void (S::*PMS)(long) const; typedef char S::*PMD; struct wat { wat& operator*() { return *this; } void foo(); }; struct F {}; template void test_result_of_imp() { static_assert((std::is_same::type, U>::value), ""); #if _LIBCPP_STD_VER > 11 static_assert((std::is_same, U>::value), ""); #endif } int main() { test_result_of_imp (); test_result_of_imp (); test_result_of_imp (); test_result_of_imp, int), void> (); test_result_of_imp (); test_result_of_imp (); #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES test_result_of_imp (); #endif test_result_of_imp (); #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES test_result_of_imp (); test_result_of_imp (); test_result_of_imp (); test_result_of_imp (); test_result_of_imp (); test_result_of_imp (); #endif #ifndef _LIBCPP_HAS_NO_TEMPLATE_ALIASES using type1 = std::result_of::type; #endif #if _LIBCPP_STD_VER > 11 using type2 = std::result_of_t; #endif static_assert((std::is_same::type, short>::value), "Error!"); static_assert((std::is_same::type, double>::value), "Error!"); static_assert((std::is_same::type, bool>::value), "Error!"); static_assert((std::is_same, int)>::type, void>::value), "Error!"); static_assert((std::is_same::type, void>::value), "Error!"); static_assert((std::is_same::type, void>::value), "Error!"); #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES static_assert((std::is_same::type, char&&>::value), "Error!"); #endif static_assert((std::is_same::type, const char&>::value), "Error!"); #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES static_assert((std::is_same::type, int>::value), "Error!"); static_assert((std::is_same::type, int>::value), "Error!"); static_assert((std::is_same::type, int>::value), "Error!"); static_assert((std::is_same::type, int>::value), "Error!"); static_assert((std::is_same::type, int>::value), "Error!"); static_assert((std::is_same::type, int>::value), "Error!"); #endif #ifndef _LIBCPP_HAS_NO_TEMPLATE_ALIASES using type = std::result_of::type; #endif }