This page is a snapshot from the LWG issues list, see the Library Active Issues List for more information and the meaning of C++17 status.
Section: 20.2.11 [specialized.addressof] Status: C++17 Submitter: Brent Friedman Opened: 2016-03-06 Last modified: 2017-07-30
Priority: 3
View all other issues in [specialized.addressof].
View all issues with C++17 status.
Discussion:
LWG issue 970 removed the rvalue reference overload for addressof. This allows const prvalues to bind to a call to addressof, which is dissimilar from the behavior of operator&.
const vector<int> a(); void b() { auto x = addressof(a()); // "ok" auto y = addressof<const int>(0); // "ok" auto z = &a(); //error: cannot take address of a temporary }
[2016-08 Chicago]
Tues PM: Move to Tentatively Ready
Proposed resolution:
This wording is relative to N4582.
Change 20.2.2 [memory.syn], header <memory> synopsis, as indicated:
[…] // 20.9.12, specialized algorithms: template <class T> constexpr T* addressof(T& r) noexcept; template <class T> const T* addressof(const T&& elem) = delete; […]
Change 20.2.11 [specialized.addressof] p1 as indicated:
template <class T> constexpr T* addressof(T& r) noexcept; template <class T> const T* addressof(const T&& elem) = delete;-1- Returns: The actual address of the object or function referenced by r, even in the presence of an overloaded operator&.