+2017-09-18 Jonathan Wakely <jwakely@redhat.com>
+
+ PR libstdc++/71187
+ * include/std/type_traits (__declval): New function to deduce return
+ type of declval.
+ (__declval_protector::_delegate): Remove.
+ (declval): Use __declval instead of add_rvalue_reference and
+ __declval_protector::__delegate.
+ * testsuite/20_util/declval/requirements/1_neg.cc: Adjust dg-error
+ lineno.
+ * testsuite/20_util/make_signed/requirements/typedefs_neg.cc:
+ Likewise.
+ * testsuite/20_util/make_unsigned/requirements/typedefs_neg.cc:
+ Likewise.
+
2017-09-15 Jakub Jelinek <jakub@redhat.com>
* testsuite/libstdc++-prettyprinters/cxx17.cc: Use -std=c++17 or
// Destructible and constructible type properties.
- template<typename>
- struct add_rvalue_reference;
-
/**
* @brief Utility to simplify expressions used in unevaluated operands
* @ingroup utilities
*/
+
+ template<typename _Tp, typename _Up = _Tp&&>
+ _Up
+ __declval(int);
+
+ template<typename _Tp>
+ _Tp
+ __declval(long);
+
template<typename _Tp>
- typename add_rvalue_reference<_Tp>::type declval() noexcept;
+ auto declval() noexcept -> decltype(__declval<_Tp>(0));
template<typename, unsigned = 0>
struct extent;
struct __declval_protector
{
static const bool __stop = false;
- static typename add_rvalue_reference<_Tp>::type __delegate();
};
template<typename _Tp>
- inline typename add_rvalue_reference<_Tp>::type
- declval() noexcept
+ auto declval() noexcept -> decltype(__declval<_Tp>(0))
{
static_assert(__declval_protector<_Tp>::__stop,
"declval() must not be used!");
- return __declval_protector<_Tp>::__delegate();
+ return __declval<_Tp>(0);
}
/// result_of
// with this library; see the file COPYING3. If not see
// <http://www.gnu.org/licenses/>.
-// { dg-error "static assertion failed" "" { target *-*-* } 2089 }
+// { dg-error "static assertion failed" "" { target *-*-* } 2093 }
#include <utility>
// { dg-error "required from here" "" { target *-*-* } 39 }
// { dg-error "required from here" "" { target *-*-* } 41 }
-// { dg-error "invalid use of incomplete type" "" { target *-*-* } 1754 }
+// { dg-error "invalid use of incomplete type" "" { target *-*-* } 1760 }
// { dg-error "required from here" "" { target *-*-* } 39 }
// { dg-error "required from here" "" { target *-*-* } 41 }
-// { dg-error "invalid use of incomplete type" "" { target *-*-* } 1650 }
+// { dg-error "invalid use of incomplete type" "" { target *-*-* } 1656 }