[RFC] Implementing addressof for C++0x

Peter Dimov pdimov@pdimov.com
Thu May 20 18:43:00 GMT 2010


Jason Merrill wrote:
> On 05/20/2010 08:18 AM, Peter Dimov wrote:
>>> On 05/20/2010 01:55 PM, Paolo Carlini wrote:
>>>> It's uglier because the code above doesn't work for functions,
>>>>
>>> By the way, do you have a specific testcase in mind?
>>>
>>> Because addressof_fn_test.cpp, part of Boost, passes...
>>
>> This is probably a g++/gcc extension... some compilers do not allow
>> references to functions to be casted to char&, and I believe the
>> standard doesn't permit that, either.
>
> 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.

Thanks; that is, then, why the latest Comeau accepts it. It didn't occur to 
me to try the earlier versions on http://www.comeaucomputing.com/tryitout/ - 
they reject the code. This paragraph is a new addition, not present in 
C++03; "conditionally supported" is a C++0x-ism. :-) 



More information about the Gcc mailing list