[C++ PATCH] Fix decltype for calls to function pointers, references

Doug Gregor doug.gregor@gmail.com
Wed Aug 6 20:37:00 GMT 2008


On Wed, Aug 6, 2008 at 3:52 PM, Mark Mitchell <mark@codesourcery.com> wrote:
> Doug Gregor wrote:
>>
>> This little patch corrects the result of decltype when applied to a
>> call to a function pointer, function reference, or member function
>> pointer.
>>
>> Okay for mainline and 4.3?
>>
>>  - Doug
>>
>> 2008-07-14  Douglas Gregor  <doug.gregor@gmail.com>
>>
>>        * g++.dg/cpp0x/decltype12.C: New.
>
> Just to be clear, the point of the complex handling of CALL_EXPR is that if
> you call a function that returns a reference, then the decltype of the call
> is the reference type, rather than the type without the reference?  (I'm
> just checking why the answer is just TREE_TYPE (call_expr).)

Yes, exactly. The decltype of a function call is the return type of
the function being called, including preserving reference types (that
have been stripped away in TREE_TYPE (call_expr).

  - Doug



More information about the Gcc-patches mailing list