[cfe-dev] Constants.cpp assertion raised

Oliver Hunt oliver at apple.com
Wed Jan 9 13:26:33 PST 2008


Okay, in all likelihood sema is failing to merge correctly as the ILE  
still has type void or some such :-/

Unfortunately just setting the "correct" type on the ILe doesn't work  
as the ILEs can be flattened, so the following are both valid:
t array1[] = {{'a'}, {'b'}, {'c'}};
t array2[] = {'a', 'b', 'c'};

Anders' probably knows more as i think he added the original sema  
logic for ILEs (at least for global initialisers).

--Oliver

On 9/01/2008, at 1:18 PM, Chris Lattner wrote:

> On Jan 9, 2008, at 1:17 PM, Oliver Hunt wrote:
>> I would actually expect this to work in the current global init  
>> code.  I suspect the code isn't check for implicit conversions or  
>> some such...  although that surprises me.
>
> The problem is that the implicit conversion isn't being emitted.   
> For reference, this does codegen correctly:
>
> typedef struct {
> unsigned char c;
> } t;
>
> const t x = { (unsigned char)1 };
>
>
>
> Note the explicit cast to char.
>
> -Chris




More information about the cfe-dev mailing list