include/std/variant (__accepted_index): Use void_t.

Message ID 20180706102032.GA25775@redhat.com
State New
Headers show
Series
  • include/std/variant (__accepted_index): Use void_t.
Related show

Commit Message

Jonathan Wakely July 6, 2018, 10:20 a.m.
Tested powerpc64le-linux, committed to trunk.
commit d66ad3c7feea986bfb95543e07b7063931d97e96
Author: Jonathan Wakely <jwakely@redhat.com>
Date:   Fri Jul 6 09:58:12 2018 +0100

            * include/std/variant (__accepted_index): Use void_t.

Patch

diff --git a/libstdc++-v3/include/std/variant b/libstdc++-v3/include/std/variant
index 63eafdd58e5..66d878142a4 100644
--- a/libstdc++-v3/include/std/variant
+++ b/libstdc++-v3/include/std/variant
@@ -710,7 +710,8 @@  namespace __variant
     };
 
   // Helper for variant(_Tp&&) and variant::operator=(_Tp&&).
-  // __accepted_index maps the arbitrary _Tp to an alternative type in _Variant.
+  // __accepted_index maps an arbitrary _Tp to an alternative type in _Variant
+  // (or to variant_npos).
   template<typename _Tp, typename _Variant, typename = void>
     struct __accepted_index
     { static constexpr size_t value = variant_npos; };
@@ -718,8 +719,7 @@  namespace __variant
   template<typename _Tp, typename... _Types>
     struct __accepted_index<
       _Tp, variant<_Types...>,
-      decltype(__overload_set<_Types...>::_S_fun(std::declval<_Tp>()),
-	       std::declval<void>())>
+      void_t<decltype(__overload_set<_Types...>::_S_fun(std::declval<_Tp>()))>>
     {
       static constexpr size_t value = sizeof...(_Types) - 1
 	- decltype(__overload_set<_Types...>::