https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100667

--- Comment #11 from Jonathan Wakely <redi at gcc dot gnu.org> ---
(In reply to Jonathan Wakely from comment #8)
> But I think it would be best to fix it in the compiler, so that we always
> allow directly binding T&& or const T& to T, even if T is incomplete.
> Otherwise we'll be playing whackamole all over the library.

Actually the workarounds would only be needed in <type_traits>:

--- a/libstdc++-v3/include/std/type_traits
+++ b/libstdc++-v3/include/std/type_traits
@@ -1187,6 +1187,16 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
        "template argument must be a complete class or an unbounded array");
     };

+  template<typename _Tp, typename _Up>
+    struct is_nothrow_constructible<_Tp&, _Up>
+    : __is_nothrow_constructible_impl<_Tp&, __add_rval_ref_t<_Up>>
+    { };
+
+  template<typename _Tp, typename _Up>
+    struct is_nothrow_constructible<_Tp&&, _Up>
+    : __is_nothrow_constructible_impl<_Tp&&, __add_rval_ref_t<_Up>>
+    { };
+
   /// is_nothrow_default_constructible
   template<typename _Tp>
     struct is_nothrow_default_constructible
@@ -1496,7 +1506,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
 #if _GLIBCXX_USE_BUILTIN_TRAIT(__is_convertible)
   template<typename _From, typename _To>
     struct is_convertible
-    : public __bool_constant<__is_convertible(_From, _To)>
+    : public __bool_constant<__is_convertible(__add_rval_ref_t<_From>, _To)>
     { };
 #else
   template<typename _From, typename _To,
@@ -1547,7 +1557,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
   /// is_nothrow_convertible_v
   template<typename _From, typename _To>
     inline constexpr bool is_nothrow_convertible_v
-      = __is_nothrow_convertible(_From, _To);
+      = __is_nothrow_convertible(__add_rval_ref_t<_From>, _To);

   /// is_nothrow_convertible
   template<typename _From, typename _To>



I think this should be OK but I haven't tested it yet.

Reply via email to