diff --git a/include/type_traits b/include/type_traits index 277a9fb07..ec158fc08 100644 --- a/include/type_traits +++ b/include/type_traits @@ -1272,11 +1272,13 @@ template using remove_all_extents_t = typename remove_all_extents<_T // decay -template -struct _LIBCPP_TEMPLATE_VIS decay -{ -private: - typedef typename remove_reference<_Tp>::type _Up; +template +struct __decay { + typedef typename remove_cv<_Up>::type type; +}; + +template +struct __decay<_Up, true> { public: typedef typename conditional < @@ -1291,6 +1293,15 @@ public: >::type type; }; +template +struct _LIBCPP_TEMPLATE_VIS decay +{ +private: + typedef typename remove_reference<_Tp>::type _Up; +public: + typedef typename __decay<_Up, __is_referenceable<_Up>::value>::type type; +}; + #if _LIBCPP_STD_VER > 11 template using decay_t = typename decay<_Tp>::type; #endif diff --git a/test/std/utilities/meta/meta.trans/meta.trans.other/decay.pass.cpp b/test/std/utilities/meta/meta.trans/meta.trans.other/decay.pass.cpp index bcd839849..4f45a0340 100644 --- a/test/std/utilities/meta/meta.trans/meta.trans.other/decay.pass.cpp +++ b/test/std/utilities/meta/meta.trans/meta.trans.other/decay.pass.cpp @@ -33,4 +33,10 @@ int main() test_decay(); test_decay(); test_decay(); +#if TEST_STD_VER > 11 + test_decay(); + test_decay(); + test_decay(); + test_decay(); +#endif }