[cfe-dev] (Unexpected) Method type

Abramo Bagnara abramobagnara at tin.it
Sun Jan 10 11:25:35 PST 2010


Il 10/01/2010 18:49, Sean Hunt ha scritto:
> On 01/10/2010 09:10 AM, Abramo Bagnara wrote:
>> template<typename T>
>> void p(T, T);
>>
>> void g();
>>
>> struct c {
>>    void h();
>>    void f() {
>>      __typeof(h) i;
>>      return p(i, g);
>>    }
>> };
> 
> clang compiles this correctly. The type of h is a void(). In the
> declaration of i, since it is a function, it is declaring extern void
> ::i(); When i and g are passed to p, they are each subjected to the
> function-to-pointer conversions, and p is called with T being void().

This is exactly the point: I don't think that type of i should become
void() as type of h IMO is not void().

Intel CC compiler, gcc and Comeau agree that the code above should not
compile.





More information about the cfe-dev mailing list