[cfe-dev] static char const []

Chris Lattner clattner at apple.com
Sun Dec 9 15:52:54 PST 2007


On Dec 8, 2007, at 6:59 AM, Steve Naroff wrote:

> This is a missing feature that will be added later today...
>
> I need to review a patch by Anders Carlsson that fixes this missing
> feature...

Thanks for looking into this Steve and Anders.  When this happens,  
please verify that the initializer also gets the appropriate type.   
Specifically, there should be an implicit cast from pointer to char to  
an array of char, and the type of that cast needs to have the  
appropriate array size.

Thanks for diving in Steve,

-Chris

>
> Thanks for the bug,
>
> snaroff
>
> On Dec 8, 2007, at 5:33 AM, Alexey Zakhlestin wrote:
>
>> $ cat test.c
>> int main(void)
>> {
>> 	static char const test[] = "test";
>> }
>>
>> $ clang -fsyntax-only test.c
>> test.c:3:20: error: variable has incomplete type 'char const []'
>>       static char const test[] = "test";
>>                         ^
>> 1 diagnostic generated.
>>
>>
>> gcc-4.0 takes this construction easily.
>> originally found in bison-generated source
>>
>>
>> -- 
>> Alexey Zakhlestin
>> http://blog.milkfarmsoft.com/
>> _______________________________________________
>> cfe-dev mailing list
>> cfe-dev at cs.uiuc.edu
>> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
>
> _______________________________________________
> cfe-dev mailing list
> cfe-dev at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev




More information about the cfe-dev mailing list