2020-02-19 Jonathan Wakely <jwakely@redhat.com>
+ * include/std/type_traits (__cpp_lib_unwrap_ref): Define (LWG 3348).
+ * include/std/version (__cpp_lib_unwrap_ref): Likewise.
+ * testsuite/20_util/unwrap_reference/1.cc: Check macro.
+ * testsuite/20_util/unwrap_reference/3.cc: New test.
+
* include/std/numeric (midpoint(T8, T*)): Do not check for complete
type during overload resolution, use static assert instead (LWG 3200).
* testsuite/26_numerics/midpoint/pointer.cc: Do not test with
template<typename _Tp>
using type_identity_t = typename type_identity<_Tp>::type;
+#define __cpp_lib_unwrap_ref 201811L
+
/// Unwrap a reference_wrapper
template<typename _Tp>
struct unwrap_reference { using type = _Tp; };
#ifdef _GLIBCXX_HAVE_BUILTIN_IS_CONSTANT_EVALUATED
# define __cpp_lib_is_constant_evaluated 201811L
#endif
+#define __cpp_lib_unwrap_ref 201811L
#if _GLIBCXX_HOSTED
#define __cpp_lib_bind_front 201907L
#include <type_traits>
+#ifndef __cpp_lib_unwrap_ref
+# error "Feature-test macro for unwrap_reference missing in <type_traits>"
+#elif __cpp_lib_unwrap_ref != 201811L
+# error "Feature-test macro for unwrap_reference has wrong value in <type_traits>"
+#endif
+
template<typename T, typename U> struct expect_same;
template<typename T> struct expect_same<T, T> : std::true_type { };
--- /dev/null
+// Copyright (C) 2020 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// { dg-options "-std=gnu++2a" }
+// { dg-do compile { target c++2a } }
+
+#include <version>
+
+#ifndef __cpp_lib_unwrap_ref
+# error "Feature-test macro for unwrap_reference missing in <version>"
+#elif __cpp_lib_unwrap_ref != 201811L
+# error "Feature-test macro for unwrap_reference has wrong value in <version>"
+#endif