[RFC] Implementing addressof for C++0x

Paolo Carlini paolo.carlini@oracle.com
Thu May 20 18:26:00 GMT 2010


On 05/20/2010 08:13 PM, Jason Merrill wrote:
> The standard permits a compiler to accept or reject such a cast.
>
> 5.2.10/8: Converting a pointer to a function into a pointer to an
> object type or vice versa is conditionally-supported.  The meaning of
> such a conversion is implementation-defined, except that if an
> implementation supports conversions in both directions, converting a
> prvalue of one type to the other type and back, possibly with
> different cv-qualification, shall yield the original pointer value.
Thanks for the clarification.

The library patch which I'll commit later today includes a very simple
implementation of std::addressof - essentially what I posted already at
the beginning of this thread - and a specific testcase making sure that
we can deal correctly with functions: if, for some reason, the compiler
changes in the future about this issue, we can immediately notice and
adjust std::addressof.

Paolo.



More information about the Libstdc++ mailing list