[cfe-dev] sizeof(sizeof(...))

Chris Lattner clattner at apple.com
Tue Dec 18 21:31:48 PST 2007


On Dec 14, 2007, at 6:06 PM, Neil Booth wrote:

> Ted Kremenek wrote:-
>
>>> is this valid:
>>>
>>> char[n*m] foo(int n, int m) { ... }
>>> ...
>>> a=sizeof(foo(x,y))
>>> ?
>>
>> This (I believe) is not valid, and I couldn't get gcc to compile
>> similar code.  From the standard: "All declarations of variably
>> modi?ed (VM) types have to be either block scope or function
>> prototype scope."
>
> It's invalid for a different reason (and one clang doesn't
> implement, ahem): the return type of a function declarator
> cannot have array type.

Does now:
http://lists.cs.uiuc.edu/pipermail/cfe-commits/Week-of-Mon-20071217/003489.html

Thanks,

-Chris



More information about the cfe-dev mailing list