diff --git a/include/__functional_base b/include/__functional_base index 52c535aa3..3274842dc 100644 --- a/include/__functional_base +++ b/include/__functional_base @@ -322,6 +322,17 @@ __invoke(_Fp&& __f, _A0&& __a0, _Args&& ...__args) return (_VSTD::forward<_A0>(__a0).*__f)(_VSTD::forward<_Args>(__args)...); } + +template +inline _LIBCPP_INLINE_VISIBILITY +auto +__invoke(_Fp&& __f, _A0&& __a0, _Args&& ...__args) + -> decltype((__a0.get().*__f)(_VSTD::forward<_Args>(__args)...)) +{ + return (__a0.get().*__f)(_VSTD::forward<_Args>(__args)...); +} + template inline _LIBCPP_INLINE_VISIBILITY @@ -344,6 +355,17 @@ __invoke(_Fp&& __f, _A0&& __a0) return _VSTD::forward<_A0>(__a0).*__f; } + +template +inline _LIBCPP_INLINE_VISIBILITY +auto +__invoke(_Fp&& __f, _A0&& __a0) + -> decltype(__a0.get().*__f) +{ + return __a0.get().*__f; +} + template inline _LIBCPP_INLINE_VISIBILITY @@ -577,10 +599,6 @@ public: #endif // _LIBCPP_HAS_NO_VARIADICS }; -template struct __is_reference_wrapper_impl : public false_type {}; -template struct __is_reference_wrapper_impl > : public true_type {}; -template struct __is_reference_wrapper - : public __is_reference_wrapper_impl::type> {}; template inline _LIBCPP_INLINE_VISIBILITY diff --git a/include/type_traits b/include/type_traits index b7b0d4d8b..d4b857e91 100644 --- a/include/type_traits +++ b/include/type_traits @@ -369,6 +369,7 @@ namespace std _LIBCPP_BEGIN_NAMESPACE_STD template struct _LIBCPP_TYPE_VIS_ONLY pair; +template class _LIBCPP_TYPE_VIS_ONLY reference_wrapper; template struct __void_t { typedef void type; }; @@ -3965,6 +3966,11 @@ template _LIBCPP_CONSTEXPR bool is_trivial_v = is_trivial<_Tp>::value; #endif +template struct __is_reference_wrapper_impl : public false_type {}; +template struct __is_reference_wrapper_impl > : public true_type {}; +template struct __is_reference_wrapper + : public __is_reference_wrapper_impl::type> {}; + #ifndef _LIBCPP_HAS_NO_VARIADICS // Check for complete types @@ -4111,6 +4117,15 @@ struct __check_complete<_Rp _Class::*> { }; + +template +using __arg_is_base_of_ptm = + is_base_of::type>::_ClassType>::type, + typename remove_reference<_A0>::type>; + +template +using __arg_is_reference_wrapper = __is_reference_wrapper::type>; + // __invoke forward declarations // fall back - none of the bullets @@ -4120,14 +4135,13 @@ auto __invoke(__any, _Args&& ...__args) -> __nat; -// bullets 1 and 2 +// bullets 1, 2 and 3 template ::type>::value && - is_base_of::type>::_ClassType>::type, - typename remove_reference<_A0>::type>::value + __arg_is_base_of_ptm<_Fp, _A0>::value >::type > _LIBCPP_INLINE_VISIBILITY @@ -4135,12 +4149,25 @@ auto __invoke(_Fp&& __f, _A0&& __a0, _Args&& ...__args) -> decltype((_VSTD::forward<_A0>(__a0).*__f)(_VSTD::forward<_Args>(__args)...)); + template ::type>::value && - !is_base_of::type>::_ClassType>::type, - typename remove_reference<_A0>::type>::value + __arg_is_reference_wrapper<_A0>::value + >::type + > +_LIBCPP_INLINE_VISIBILITY +auto +__invoke(_Fp&& __f, _A0&& __a0, _Args&& ...__args) + -> decltype((__a0.get().*__f)(_VSTD::forward<_Args>(__args)...)); + +template ::type>::value && + !__arg_is_base_of_ptm<_Fp, _A0>::value && + !__arg_is_reference_wrapper<_A0>::value >::type > _LIBCPP_INLINE_VISIBILITY @@ -4148,14 +4175,13 @@ auto __invoke(_Fp&& __f, _A0&& __a0, _Args&& ...__args) -> decltype(((*_VSTD::forward<_A0>(__a0)).*__f)(_VSTD::forward<_Args>(__args)...)); -// bullets 3 and 4 +// bullets 4, 5 and 6 template ::type>::value && - is_base_of::type>::_ClassType, - typename remove_reference<_A0>::type>::value + __arg_is_base_of_ptm<_Fp, _A0>::value >::type > _LIBCPP_INLINE_VISIBILITY @@ -4163,12 +4189,25 @@ auto __invoke(_Fp&& __f, _A0&& __a0) -> decltype(_VSTD::forward<_A0>(__a0).*__f); + template ::type>::value && - !is_base_of::type>::_ClassType, - typename remove_reference<_A0>::type>::value + __arg_is_reference_wrapper<_A0>::value + >::type + > +_LIBCPP_INLINE_VISIBILITY +auto +__invoke(_Fp&& __f, _A0&& __a0) + -> decltype(__a0.get().*__f); + +template ::type>::value && + !__arg_is_base_of_ptm<_Fp, _A0>::value && + !__arg_is_reference_wrapper<_A0>::value >::type > _LIBCPP_INLINE_VISIBILITY @@ -4176,7 +4215,7 @@ auto __invoke(_Fp&& __f, _A0&& __a0) -> decltype((*_VSTD::forward<_A0>(__a0)).*__f); -// bullet 5 +// bullet 7 template _LIBCPP_INLINE_VISIBILITY diff --git a/include/utility b/include/utility index c9f5785b3..6db323e77 100644 --- a/include/utility +++ b/include/utility @@ -501,7 +501,6 @@ swap(pair<_T1, _T2>& __x, pair<_T1, _T2>& __y) #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES -template class _LIBCPP_TYPE_VIS_ONLY reference_wrapper; template struct __make_pair_return_impl diff --git a/test/std/utilities/function.objects/func.invoke/invoke.pass.cpp b/test/std/utilities/function.objects/func.invoke/invoke.pass.cpp index 97b0b4d15..3f02c7c4c 100644 --- a/test/std/utilities/function.objects/func.invoke/invoke.pass.cpp +++ b/test/std/utilities/function.objects/func.invoke/invoke.pass.cpp @@ -172,6 +172,32 @@ void bullet_one_two_tests() { test_b12(std::move(cl)); test_b12(std::move(cl)); } + { + TestClass cl_obj(42); + std::reference_wrapper cl(cl_obj); + test_b12(cl); + test_b12(cl); + test_b12(cl); + test_b12(cl); + + test_b12(std::move(cl)); + test_b12(std::move(cl)); + test_b12(std::move(cl)); + test_b12(std::move(cl)); + } + { + DerivedFromTestClass cl_obj(42); + std::reference_wrapper cl(cl_obj); + test_b12(cl); + test_b12(cl); + test_b12(cl); + test_b12(cl); + + test_b12(std::move(cl)); + test_b12(std::move(cl)); + test_b12(std::move(cl)); + test_b12(std::move(cl)); + } { TestClass cl_obj(42); TestClass *cl = &cl_obj; @@ -217,6 +243,22 @@ void bullet_three_four_tests() { test_b34(static_cast(cl)); test_b34(static_cast(cl)); } + { + typedef TestClass Fn; + Fn cl(42); + test_b34(std::reference_wrapper(cl)); + test_b34(std::reference_wrapper(cl)); + test_b34(std::reference_wrapper(cl)); + test_b34(std::reference_wrapper(cl)); + } + { + typedef DerivedFromTestClass Fn; + Fn cl(42); + test_b34(std::reference_wrapper(cl)); + test_b34(std::reference_wrapper(cl)); + test_b34(std::reference_wrapper(cl)); + test_b34(std::reference_wrapper(cl)); + } { typedef TestClass Fn; Fn cl_obj(42); diff --git a/test/std/utilities/function.objects/func.require/bullet_1_and_2.pass.cpp b/test/std/utilities/function.objects/func.require/bullet_1_2_3.pass.cpp similarity index 86% rename from test/std/utilities/function.objects/func.require/bullet_1_and_2.pass.cpp rename to test/std/utilities/function.objects/func.require/bullet_1_2_3.pass.cpp index e579f207a..09e8e2113 100644 --- a/test/std/utilities/function.objects/func.require/bullet_1_and_2.pass.cpp +++ b/test/std/utilities/function.objects/func.require/bullet_1_2_3.pass.cpp @@ -14,12 +14,14 @@ //------------------------------------------------------------------------------ // TESTING INVOKE(f, t1, t2, ..., tN) // - Bullet 1 -- (t1.*f)(t2, ..., tN) -// - Bullet 2 -- ((*t1).*f)(t2, ..., tN) +// - Bullet 2 -- (t1.get().*f)(t2, ..., tN) // t1 is a reference_wrapper +// - Bullet 3 -- ((*t1).*f)(t2, ..., tN) // // Overview: -// Bullets 1 and 2 handle the case where 'f' is a pointer to member function. +// Bullets 1, 2 and 3 handle the case where 'f' is a pointer to member function. // Bullet 1 only handles the cases where t1 is an object of type T or a -// type derived from 'T'. Bullet 2 handles all other cases. +// type derived from 'T'. Bullet 2 handles the case where 't1' is a reference +// wrapper and bullet 3 handles all other cases. // // Concerns: // 1) cv-qualified member function signatures are accepted. @@ -31,6 +33,7 @@ // as the call object. // 7) Pointers to T or a type derived from T can be used as the call object. // 8) Reference return types are properly deduced. +// 9) reference_wrappers are properly handled and unwrapped. // // // Plan: @@ -123,6 +126,7 @@ private: #endif // TEST_STD_VER >= 11 + //============================================================================== // TestCase - A test case for a single member function. // ClassType - The type of the class being tested. @@ -151,6 +155,8 @@ private: D* der_ptr = &der; DerefToType dref; DerefPropType dref2; + std::reference_wrapper rref(obj); + std::reference_wrapper drref(der); // (Plan-3) Dispatch based on the CV tags. CV tag; @@ -158,9 +164,13 @@ private: runTestDispatch(tag, obj); runTestDispatch(tag, der); runTestDispatch(tag, dref2); - runTestDispatchIf(NotRValue, tag, dref); - runTestDispatchIf(NotRValue, tag, obj_ptr); + runTestDispatchIf(NotRValue, tag, dref); + runTestDispatchIf(NotRValue, tag, obj_ptr); runTestDispatchIf(NotRValue, tag, der_ptr); +#if TEST_STD_VER >= 11 + runTestDispatchIf(NotRValue, tag, rref); + runTestDispatchIf(NotRValue, tag, drref); +#endif } template @@ -179,27 +189,43 @@ private: template void runTestDispatch(Q_Const, Tp& v) { - Tp const& cv = v; runTest(v); - runTest(cv); + runTest(makeConst(v)); } template void runTestDispatch(Q_Volatile, Tp& v) { - Tp volatile& vv = v; runTest(v); - runTest(vv); + runTest(makeVolatile(v)); + } template void runTestDispatch(Q_CV, Tp& v) { - Tp const& cv = v; - Tp volatile& vv = v; - Tp const volatile& cvv = v; runTest(v); - runTest(cv); - runTest(vv); - runTest(cvv); + runTest(makeConst(v)); + runTest(makeVolatile(v)); + runTest(makeCV(v)); + } + + template + void runTest(const std::reference_wrapper& obj) { + typedef Caster SCast; + typedef Caster ACast; + typedef CallSig (ClassType::*MemPtr); + // Delegate test to logic in invoke_helpers.h + BasicTest, Arity, SCast, ACast> b; + b.runTest( (MemPtr)&ClassType::f, obj); + } + + template + void runTest(T* obj) { + typedef Caster SCast; + typedef Caster ACast; + typedef CallSig (ClassType::*MemPtr); + // Delegate test to logic in invoke_helpers.h + BasicTest, Arity, SCast, ACast> b; + b.runTest( (MemPtr)&ClassType::f, obj); } template @@ -221,6 +247,27 @@ template struct TestCase11 : public TestCaseImp {}; #endif +template +struct DerivedFromRefWrap : public std::reference_wrapper { + DerivedFromRefWrap(Tp& tp) : std::reference_wrapper(tp) {} +}; + +#if TEST_STD_VER >= 11 +void test_derived_from_ref_wrap() { + int x = 42; + std::reference_wrapper r(x); + std::reference_wrapper> r2(r); + DerivedFromRefWrap d(x); + auto get_fn = &std::reference_wrapper::get; + auto& ret = std::__invoke(get_fn, r); + assert(&ret == &x); + auto& ret2 = std::__invoke(get_fn, d); + assert(&ret2 == &x); + auto& ret3 = std::__invoke(get_fn, r2); + assert(&ret3 == &x); +} +#endif + int main() { typedef void*& R; typedef ArgType A; @@ -314,5 +361,7 @@ int main() { TestCase11::run(); TestCase11::run(); TestCase11::run(); + + test_derived_from_ref_wrap(); #endif } \ No newline at end of file diff --git a/test/std/utilities/function.objects/func.require/bullet_3_and_4.pass.cpp b/test/std/utilities/function.objects/func.require/bullet_4_5_6.pass.cpp similarity index 64% rename from test/std/utilities/function.objects/func.require/bullet_3_and_4.pass.cpp rename to test/std/utilities/function.objects/func.require/bullet_4_5_6.pass.cpp index b6fe190bd..2007c417a 100644 --- a/test/std/utilities/function.objects/func.require/bullet_3_and_4.pass.cpp +++ b/test/std/utilities/function.objects/func.require/bullet_4_5_6.pass.cpp @@ -13,13 +13,15 @@ //------------------------------------------------------------------------------ // TESTING INVOKE(f, t1, t2, ..., tN) -// - Bullet 3 -- t1.*f -// - Bullet 4 -- (*t1).*f +// - Bullet 4 -- t1.*f +// - Bullet 5 -- t1.get().*f // t1 is a reference wrapper. +// - Bullet 6 -- (*t1).*f // // Overview: -// Bullets 3 and 4 handle the case where 'f' is a pointer to member object. -// Bullet 3 only handles the cases where t1 is an object of type T or a -// type derived from 'T'. Bullet 4 handles all other cases. +// Bullets 4, 5 and 6 handle the case where 'f' is a pointer to member object. +// Bullet 4 only handles the cases where t1 is an object of type T or a +// type derived from 'T'. Bullet 5 handles cases where 't1' is a reference_wrapper +// and bullet 6 handles all other cases. // // Concerns: // 1) The return type is always an lvalue reference. @@ -30,6 +32,7 @@ // 6) All types that dereference to T or a type derived from T can be used // as the call object. // 7) Pointers to T or a type derived from T can be used as the call object. +// 8) reference_wrapper's are properly unwrapped before invoking the function. #include #include @@ -66,6 +69,8 @@ private: Derived* der_ptr = &der; DerefToType dref; DerefPropType dref2; + std::reference_wrapper rref(obj); + std::reference_wrapper drref(der); { typedef ObjectType (TestType::*MemPtr); @@ -74,9 +79,13 @@ private: runTestDispatch(M, obj, &obj.object); runTestDispatch(M, der, &der.object); runTestDispatch(M, dref2, &dref2.object.object); - runTestPointerDispatch(M, obj_ptr, &obj_ptr->object); - runTestPointerDispatch(M, der_ptr, &der_ptr->object); - runTestPointerDispatch(M, dref, &dref.object.object); + runTestPropCVDispatch(M, obj_ptr, &obj_ptr->object); + runTestPropCVDispatch(M, der_ptr, &der_ptr->object); +#if TEST_STD_VER >= 11 + runTestPropCVDispatch(M, rref, &(rref.get().object)); + runTestPropCVDispatch(M, drref, &(drref.get().object)); +#endif + runTestNoPropDispatch(M, dref, &dref.object.object); } { typedef ObjectType const (TestType::*CMemPtr); @@ -85,9 +94,13 @@ private: runTestDispatch(M, obj, &obj.object); runTestDispatch(M, der, &der.object); runTestDispatch(M, dref2, &dref2.object.object); - runTestPointerDispatch(M, obj_ptr, &obj_ptr->object); - runTestPointerDispatch(M, der_ptr, &der_ptr->object); - runTestPointerDispatch(M, dref, &dref.object.object); + runTestPropCVDispatch(M, obj_ptr, &obj_ptr->object); + runTestPropCVDispatch(M, der_ptr, &der_ptr->object); +#if TEST_STD_VER >= 11 + runTestPropCVDispatch(M, rref, &(rref.get().object)); + runTestPropCVDispatch(M, drref, &(drref.get().object)); +#endif + runTestNoPropDispatch(M, dref, &dref.object.object); } { typedef ObjectType volatile (TestType::*VMemPtr); @@ -96,9 +109,13 @@ private: runTestDispatch(M, obj, &obj.object); runTestDispatch(M, der, &der.object); runTestDispatch(M, dref2, &dref2.object.object); - runTestPointerDispatch(M, obj_ptr, &obj_ptr->object); - runTestPointerDispatch(M, der_ptr, &der_ptr->object); - runTestPointerDispatch(M, dref, &dref.object.object); + runTestPropCVDispatch(M, obj_ptr, &obj_ptr->object); + runTestPropCVDispatch(M, der_ptr, &der_ptr->object); +#if TEST_STD_VER >= 11 + runTestPropCVDispatch(M, rref, &(rref.get().object)); + runTestPropCVDispatch(M, drref, &(drref.get().object)); +#endif + runTestNoPropDispatch(M, dref, &dref.object.object); } { typedef ObjectType const volatile (TestType::*CVMemPtr); @@ -107,9 +124,13 @@ private: runTestDispatch(M, obj, &obj.object); runTestDispatch(M, der, &der.object); runTestDispatch(M, dref2, &dref2.object.object); - runTestPointerDispatch(M, obj_ptr, &obj_ptr->object); - runTestPointerDispatch(M, der_ptr, &der_ptr->object); - runTestPointerDispatch(M, dref, &dref.object.object); + runTestPropCVDispatch(M, obj_ptr, &obj_ptr->object); + runTestPropCVDispatch(M, der_ptr, &der_ptr->object); +#if TEST_STD_VER >= 11 + runTestPropCVDispatch(M, rref, &(rref.get().object)); + runTestPropCVDispatch(M, drref, &(drref.get().object)); +#endif + runTestNoPropDispatch(M, dref, &dref.object.object); } } @@ -128,7 +149,15 @@ private: } template - void runTestPointerDispatch(Fn M, T& obj, ObjectType* expect) { + void runTestPropCVDispatch(Fn M, T& obj, ObjectType* expect) { + runTest (M, obj, expect); + runTest (M, makeConst(obj), expect); + runTest (M, makeVolatile(obj), expect); + runTest(M, makeCV(obj), expect); + } + + template + void runTestNoPropDispatch(Fn M, T& obj, ObjectType* expect) { runTest(M, C_(obj), expect); runTest(M, C_(obj), expect); runTest(M, C_(obj), expect); @@ -141,6 +170,15 @@ private: #endif } + template + void runTest(Fn M, const T& obj, ObjectType* expect) { + static_assert((std::is_same< + decltype(std::__invoke(M, obj)), Expect + >::value), ""); + Expect e = std::__invoke(M, obj); + assert(&e == expect); + } + template #if TEST_STD_VER >= 11 void runTest(Fn M, T&& obj, ObjectType* expect) { @@ -155,6 +193,9 @@ private: } }; + + + int main() { TestCase::run(); TestCase::run(); diff --git a/test/std/utilities/function.objects/func.require/bullet_5.pass.cpp b/test/std/utilities/function.objects/func.require/bullet_7.pass.cpp similarity index 99% rename from test/std/utilities/function.objects/func.require/bullet_5.pass.cpp rename to test/std/utilities/function.objects/func.require/bullet_7.pass.cpp index 3f3c96a9b..0d14a350c 100644 --- a/test/std/utilities/function.objects/func.require/bullet_5.pass.cpp +++ b/test/std/utilities/function.objects/func.require/bullet_7.pass.cpp @@ -13,10 +13,10 @@ //------------------------------------------------------------------------------ // TESTING INVOKE(f, t1, t2, ..., tN) -// - Bullet 5 -- f(t2, ..., tN) +// - Bullet 7 -- f(t2, ..., tN) // // Overview: -// Bullet 5 handles the cases where the first argument is not a member +// Bullet 7 handles the cases where the first argument is not a member // function. // // Concerns: diff --git a/test/std/utilities/function.objects/func.require/invoke_helpers.h b/test/std/utilities/function.objects/func.require/invoke_helpers.h index a85b39f37..495703d0e 100644 --- a/test/std/utilities/function.objects/func.require/invoke_helpers.h +++ b/test/std/utilities/function.objects/func.require/invoke_helpers.h @@ -79,6 +79,40 @@ typedef Caster MoveConstCaster; typedef Caster MoveVolatileCaster; typedef Caster MoveCVCaster; + +template +Tp const& makeConst(Tp& ref) { return ref; } + +template +Tp const* makeConst(Tp* ptr) { return ptr; } + +template +std::reference_wrapper makeConst(std::reference_wrapper& ref) { + return std::reference_wrapper(ref.get()); +} + +template +Tp volatile& makeVolatile(Tp& ref) { return ref; } + +template +Tp volatile* makeVolatile(Tp* ptr) { return ptr; } + +template +std::reference_wrapper makeVolatile(std::reference_wrapper& ref) { + return std::reference_wrapper(ref.get()); +} + +template +Tp const volatile& makeCV(Tp& ref) { return ref; } + +template +Tp const volatile* makeCV(Tp* ptr) { return ptr; } + +template +std::reference_wrapper makeCV(std::reference_wrapper& ref) { + return std::reference_wrapper(ref.get()); +} + // A shorter name for 'static_cast' template QualType C_(Tp& v) { return static_cast(v); }; diff --git a/test/std/utilities/meta/meta.trans/meta.trans.other/result_of.pass.cpp b/test/std/utilities/meta/meta.trans/meta.trans.other/result_of.pass.cpp index 5a925bb34..3ac7d1bc9 100644 --- a/test/std/utilities/meta/meta.trans/meta.trans.other/result_of.pass.cpp +++ b/test/std/utilities/meta/meta.trans/meta.trans.other/result_of.pass.cpp @@ -13,6 +13,7 @@ #include #include +#include #include "test_macros.h" struct S @@ -25,6 +26,11 @@ struct S double const volatile& operator()(char, int&) const volatile; }; + +struct SD : public S { }; + +struct NotDerived {}; + template struct Voider { typedef void type; @@ -52,6 +58,7 @@ void test_no_result() int main() { + typedef NotDerived ND; { // functor object test_result_of (); test_result_of (); @@ -90,32 +97,64 @@ int main() 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_result_of (); + test_result_of (); + test_result_of (); + test_result_of (); + test_result_of), int> (); + test_result_of&), int> (); + test_result_of), int> (); + test_result_of&), int> (); + test_result_of), int> (); + test_result_of), int> (); test_no_result(); test_no_result(); test_no_result(); + test_no_result(); + test_no_result(); + test_no_result )>(); + 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_result_of (); + test_result_of (); + test_result_of (); + test_result_of (); + test_result_of, int), int*> (); + test_result_of, int), int*> (); + test_result_of, int), int*> (); + test_result_of&, int), int*> (); + test_result_of, int), int*> (); + test_result_of&, int), int*> (); test_no_result(); test_no_result(); test_no_result(); + test_no_result(); + test_no_result(); + test_no_result, int)>(); + test_no_result, int)>(); + test_no_result, int)>(); + test_no_result, int)>(); test_result_of (); test_result_of (); test_result_of (); test_result_of (); test_result_of, int, int), int&> (); + test_result_of, int, int), int&> (); + test_result_of, int, int), int&> (); + test_result_of&, int, int), int&> (); + test_result_of, int, int), int&> (); + test_result_of&, int, int), int&> (); test_no_result(); test_no_result(); test_no_result(); + test_no_result, int, int)>(); + test_no_result, int, int)>(); + test_no_result(); + test_no_result, int, int)>(); + test_no_result, int, int)>(); typedef int (S::*PMS0C)() const; typedef int* (S::*PMS1C)(long) const; @@ -128,6 +167,15 @@ int main() test_result_of (); test_result_of (); test_result_of), int> (); + test_result_of), int> (); + test_result_of ), int> (); + test_result_of ), int> (); + test_result_of & ), int> (); + test_result_of &), int> (); + test_result_of ), int> (); + test_result_of ), int> (); + test_result_of & ), int> (); + test_result_of &), int> (); test_no_result(); test_no_result(); @@ -248,5 +296,16 @@ int main() test_result_of (); test_result_of (); test_result_of (); + test_result_of(); + test_result_of(); + test_result_of(); + test_result_of(); + test_result_of), char &>(); + test_result_of), const char&>(); +#if TEST_STD_VER >= 11 + test_result_of), char&>(); + test_result_of), const char&>(); +#endif + test_no_result(); } } diff --git a/test/std/utilities/meta/meta.trans/meta.trans.other/result_of11.pass.cpp b/test/std/utilities/meta/meta.trans/meta.trans.other/result_of11.pass.cpp index 6996cddc0..a00887384 100644 --- a/test/std/utilities/meta/meta.trans/meta.trans.other/result_of11.pass.cpp +++ b/test/std/utilities/meta/meta.trans/meta.trans.other/result_of11.pass.cpp @@ -14,6 +14,8 @@ // result_of #include +#include +#include #include "test_macros.h" struct wat @@ -23,6 +25,8 @@ struct wat }; struct F {}; +struct FD : public F {}; +struct NotDerived {}; template void test_result_of_imp() @@ -35,6 +39,7 @@ void test_result_of_imp() int main() { + typedef NotDerived ND; { typedef char F::*PMD; test_result_of_imp(); @@ -51,6 +56,31 @@ int main() 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 (); @@ -83,6 +113,42 @@ int main() 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(); } diff --git a/www/cxx1z_status.html b/www/cxx1z_status.html index 661e312c1..25d1350c9 100644 --- a/www/cxx1z_status.html +++ b/www/cxx1z_status.html @@ -172,7 +172,7 @@ 2133Attitude to overloaded comma for iteratorsKonaComplete 2156Unordered containers' reserve(n) reserves for n-1 elementsKonaComplete 2218Unclear how containers use allocator_traits::construct()Kona - 2219INVOKE-ing a pointer to member with a reference_wrapper as the object expressionKona + 2219INVOKE-ing a pointer to member with a reference_wrapper as the object expressionKonaComplete 2224Ambiguous status of access to non-live objectsKonaComplete 2234assert() should allow usage in constant expressionsKonaComplete 2244Issue on basic_istream::seekgKonaComplete