[cfe-dev] Constants.cpp assertion raised
Oliver Hunt
oliver at apple.com
Wed Jan 9 13:17:04 PST 2008
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.
--Oliver
On 9/01/2008, at 1:14 PM, Chris Lattner wrote:
> On Jan 9, 2008, at 1:00 AM, Michael Zolda wrote:
>> Here is another piece of code that causes a crash (current SVN
>> version):
>>
>> typedef struct {
>> unsigned char c;
>> } t;
>>
>> const t x = { 1 };
>
> This looks like the "struct initializers aren't fully implemented"
> issue. Consider this:
>
> typedef struct {
> unsigned char c;
> } t;
>
> void foo() {
> const t x = { 1 };
> }
>
>
> $ clang -ast-dump crash.c
> void foo()
> (CompoundStmt 0x806460 <crash.c:5:12, line:7:1>
> (DeclStmt 0x806450 <:0:0>
> 0x8062f0 "t const x =
> (InitListExpr 0x806430 <crash.c:6:13, col:17> 't const':'struct
> <anonymous>'
> (IntegerLiteral 0x806320 <col:15> 'int' 1))")
>
> I'd expect the IntegerLiteral to be wrapped in an ImplicitCast that
> converts it from int to unsigned char. Steve, can you please
> investigate then when you start work on struct initializers?
>
> Thanks,
>
> -Chris
> _______________________________________________
> 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