Hi

As proposed on another thread here is the patch to make std::__addressof and std::addressof compile time equivalent.

Maybe not entirely because of the [[__nodiscard__]] on std::addressof but still closer.

    libstdc++: Have std::addressof use __builtin_addressof

    Rather than calling std::__addressof in std::addressof we can directly
    call __builtin_addressof to bypass 1 function call.

    libstdc++-v3/ChangeLog:

            * include/bits/move.h (std::addressof): Call __builtin_addressof.

Ok to commit ?

François
diff --git a/libstdc++-v3/include/bits/move.h b/libstdc++-v3/include/bits/move.h
index 8397a01b632..421e37509ea 100644
--- a/libstdc++-v3/include/bits/move.h
+++ b/libstdc++-v3/include/bits/move.h
@@ -161,7 +161,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
     _GLIBCXX_NODISCARD
     inline _GLIBCXX17_CONSTEXPR _Tp*
     addressof(_Tp& __r) noexcept
-    { return std::__addressof(__r); }
+    { return __builtin_addressof(__r); }
 
   // _GLIBCXX_RESOLVE_LIB_DEFECTS
   // 2598. addressof works on temporaries

Reply via email to