Qualify std::__invoke in <variant> to prevent ADL

Message ID 20180515120402.GA26806@redhat.com
State New
Headers show
Series
  • Qualify std::__invoke in <variant> to prevent ADL
Related show

Commit Message

Jonathan Wakely May 15, 2018, 12:04 p.m.
Calling unqualified __invoke can't find the wrong function, because
users can't use that name in their own namespaces, but qualifying it
should make name lookup slightly faster.

	* include/std/variant (__gen_vtable_impl::__visit_invoke): Qualify
	__invoke to prevent ADL.

Tested powerpc64le-linux, committed to trunk.
commit c2f226ebd16d0f2f6cba92cd87f55282697bbd3a
Author: Jonathan Wakely <jwakely@redhat.com>
Date:   Tue May 15 01:05:39 2018 +0100

    Qualify std::__invoke in <variant> to prevent ADL
    
            * include/std/variant (__gen_vtable_impl::__visit_invoke): Qualify
            __invoke to prevent ADL.

Patch

diff --git a/libstdc++-v3/include/std/variant b/libstdc++-v3/include/std/variant
index 40b3b566938..c0212404bb2 100644
--- a/libstdc++-v3/include/std/variant
+++ b/libstdc++-v3/include/std/variant
@@ -838,9 +838,8 @@  namespace __variant
       decltype(auto)
       static constexpr __visit_invoke(_Visitor&& __visitor, _Variants... __vars)
       {
-	return __invoke(std::forward<_Visitor>(__visitor),
-			std::get<__indices>(
-			    std::forward<_Variants>(__vars))...);
+	return std::__invoke(std::forward<_Visitor>(__visitor),
+	    std::get<__indices>(std::forward<_Variants>(__vars))...);
       }
 
       static constexpr auto