diff --git a/libstdc++-v3/include/std/type_traits b/libstdc++-v3/include/std/type_traits index 1f8b57b04a0..eaf06fcb036 100644 --- a/libstdc++-v3/include/std/type_traits +++ b/libstdc++-v3/include/std/type_traits @@ -3223,12 +3223,21 @@ template /// Remove references and cv-qualifiers. template struct remove_cvref - { - using type = __remove_cvref_t<_Tp>; - }; + : remove_cv<_Tp> + { }; template - using remove_cvref_t = __remove_cvref_t<_Tp>; + struct remove_cvref<_Tp&> + : remove_cv<_Tp> + { }; + + template + struct remove_cvref<_Tp&&> + : remove_cv<_Tp> + { }; + + template + using remove_cvref_t = typename remove_cvref<_Tp>::type; #define __cpp_lib_type_identity 201806L /// Identity metafunction. diff --git a/libstdc++-v3/testsuite/20_util/remove_cvref/value.cc b/libstdc++-v3/testsuite/20_util/remove_cvref/value.cc index d4a28422977..a4f50d433dc 100644 --- a/libstdc++-v3/testsuite/20_util/remove_cvref/value.cc +++ b/libstdc++-v3/testsuite/20_util/remove_cvref/value.cc @@ -48,3 +48,10 @@ void test01() static_assert(is_same::type, const int()>::value, ""); } + +// Declare using nested name of class template +template T func(typename std::remove_cvref::type); +// Define using alias +template T func(std::remove_cvref_t t) { return t; } +// Call must not be ambiguous +int i = func(1);