//===----------------------------------------------------------------------===// // // 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 #include "test_macros.h" struct S { typedef short (*FreeFunc)(long); operator FreeFunc() const; double operator()(char, int&); double const& operator()(char, int&) const; double volatile& operator()(char, int&) volatile; double const volatile& operator()(char, int&) const volatile; }; template struct Voider { typedef void type; }; template struct HasType : std::false_type {}; template struct HasType::type> : std::true_type {}; template void test_result_of() { static_assert((std::is_same::type, U>::value), ""); } template void test_no_result() { #if TEST_STD_VER >= 11 static_assert((!HasType >::value), ""); #endif } int main() { { // functor object test_result_of (); test_result_of (); test_result_of (); test_result_of (); test_result_of (); } { // pointer to function typedef bool (&RF0)(); typedef bool* (&RF1)(int); typedef bool& (&RF2)(int, int); typedef bool const& (&RF3)(int, int, int); typedef bool (*PF0)(); typedef bool* (*PF1)(int); typedef bool& (*PF2)(int, int); typedef bool const& (*PF3)(int, int, int); typedef bool (*&PRF0)(); typedef bool* (*&PRF1)(int); typedef bool& (*&PRF2)(int, int); typedef bool const& (*&PRF3)(int, int, int); test_result_of(); test_result_of(); test_result_of(); test_result_of(); test_result_of(); test_result_of(); test_result_of(); test_result_of(); test_result_of(); test_result_of(); test_result_of(); test_result_of(); } { // pointer to member function typedef int (S::*PMS0)(); typedef int* (S::*PMS1)(long); typedef int& (S::*PMS2)(long, int); test_result_of (); test_result_of (); test_result_of (); test_result_of (); test_result_of), int> (); test_no_result(); test_no_result(); test_no_result(); test_result_of (); test_result_of (); test_result_of (); test_result_of (); test_result_of, int), int*> (); test_no_result(); test_no_result(); test_no_result(); test_result_of (); test_result_of (); test_result_of (); test_result_of (); test_result_of, int, int), int&> (); test_no_result(); test_no_result(); test_no_result(); typedef int (S::*PMS0C)() const; typedef int* (S::*PMS1C)(long) const; typedef int& (S::*PMS2C)(long, int) const; test_result_of (); test_result_of (); test_result_of (); test_result_of (); test_result_of (); test_result_of (); test_result_of (); test_result_of), int> (); test_no_result(); test_no_result(); test_result_of (); test_result_of (); test_result_of (); test_result_of (); test_result_of (); test_result_of (); test_result_of (); test_result_of, int), int*> (); test_no_result(); test_no_result(); test_result_of (); test_result_of (); test_result_of (); test_result_of (); test_result_of (); test_result_of (); test_result_of (); test_result_of, int, int), int&> (); test_no_result(); test_no_result(); typedef int (S::*PMS0V)() volatile; typedef int* (S::*PMS1V)(long) volatile; typedef int& (S::*PMS2V)(long, int) volatile; test_result_of (); test_result_of (); test_result_of (); test_result_of (); test_result_of (); test_result_of (); test_result_of (); test_result_of), int> (); test_no_result(); test_no_result(); test_result_of (); test_result_of (); test_result_of (); test_result_of (); test_result_of (); test_result_of (); test_result_of (); test_result_of, int), int*> (); test_no_result(); test_no_result(); test_result_of (); test_result_of (); test_result_of (); test_result_of (); test_result_of (); test_result_of (); test_result_of (); test_result_of, int, int), int&> (); test_no_result(); test_no_result(); typedef int (S::*PMS0CV)() const volatile; typedef int* (S::*PMS1CV)(long) const volatile; typedef int& (S::*PMS2CV)(long, int) const volatile; test_result_of (); test_result_of (); test_result_of (); test_result_of (); test_result_of (); test_result_of (); test_result_of (); test_result_of (); test_result_of (); test_result_of (); test_result_of (); test_result_of (); test_result_of (); test_result_of), int> (); test_result_of (); test_result_of (); test_result_of (); test_result_of (); test_result_of (); test_result_of (); test_result_of (); test_result_of (); test_result_of (); test_result_of (); test_result_of (); test_result_of (); test_result_of (); test_result_of, int), int*> (); test_result_of (); test_result_of (); test_result_of (); test_result_of (); test_result_of (); test_result_of (); test_result_of (); test_result_of (); test_result_of (); test_result_of (); test_result_of (); test_result_of (); test_result_of (); test_result_of, int, int), int&> (); } { // pointer to member data typedef char S::*PMD; test_result_of(); test_result_of(); test_result_of(); test_result_of (); test_result_of (); test_result_of (); test_result_of (); test_result_of (); test_result_of (); } }