If std::addressof can be made constexpr, then the iterator member functions of std::array should be able to be made constexpr as well (begin/end, etc.) As it stands, std::addressof calls into std::__addressof, which has a reinterpret_cast, killing constexpr. If some variation of http://gcc.gnu.org/onlinedocs/gcc/Return-Address.html could be extended to support this, then the new intrinsic could be used to implement std::addressof.
I agree, an intrinsic is needed
Daniel, I'm confused: didn't we agree in that other open PR we have got about reinterpret_cast vs constexpr that actually the Standard should be amended exactly to allow this meaningful use of reint cast in the impl of address_of?
(In reply to comment #2) During the Portland meeting the issue http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_active.html#1384 was discussed and core had consensus *not* to support reinterpret_cast in constant core expressions. I think this means we need to bite the bullet now.
Ok, thanks, I wasn't there. Then please somebody add a note to that other PR. In any case, the other PR being about us actually accepting reint casts for the time being, I think it's Ok for our library to just constexpr for the time being and add a big comment about this PR, that is about the eventual need of an intrinsics as implementation detail.
Since LWG decided not to allow implementations to add constexpr (sigh), I guess we don't need this intrinsic.
(In reply to Jason Merrill from comment #5) Given that there exists the still open issue http://cplusplus.github.io/LWG/lwg-active.html#2296 should this bugzilla issue remain open?
std::addressof can be constexpr with -std=gnu++XX, and even in strict mode std::__addressof can be constexpr for internal use in libstdc++.
Although implementations can't add constexpr in general, LWG decided that they are required to add it to std::addressof: http://cplusplus.github.io/LWG/lwg-defects.html#2296 So confirming as a required feature.
r240873 added __builtin_addressof and r240929 made std::addressof use it.