[cfe-dev] initializer bug
Chris Lattner
clattner at apple.com
Fri Nov 30 21:40:47 PST 2007
Hi Steve,
Can you please investigate this code when you get a chance?
typedef struct { double x,y,z; } VECTOR;
VECTOR Skycolor[2] = { { 0.5, 0.3, 0.7 }, { 0.0, 0.0, 0.2 } };
t.c:2:26: error: incompatible types assigning 'double' to 'VECTOR'
VECTOR Skycolor[2] = { { 0.5, 0.3, 0.7 }, { 0.0, 0.0, 0.2 } };
^~~
t.c:2:26: warning: excess elements in array initializer
VECTOR Skycolor[2] = { { 0.5, 0.3, 0.7 }, { 0.0, 0.0, 0.2 } };
^~~
t.c:2:31: error: incompatible types assigning 'double' to 'VECTOR'
VECTOR Skycolor[2] = { { 0.5, 0.3, 0.7 }, { 0.0, 0.0, 0.2 } };
^~~
t.c:2:31: warning: excess elements in array initializer
VECTOR Skycolor[2] = { { 0.5, 0.3, 0.7 }, { 0.0, 0.0, 0.2 } };
^~~
t.c:2:36: error: incompatible types assigning 'double' to 'VECTOR'
VECTOR Skycolor[2] = { { 0.5, 0.3, 0.7 }, { 0.0, 0.0, 0.2 } };
^~~
t.c:2:36: warning: excess elements in array initializer
VECTOR Skycolor[2] = { { 0.5, 0.3, 0.7 }, { 0.0, 0.0, 0.2 } };
^~~
t.c:2:45: error: incompatible types assigning 'double' to 'VECTOR'
VECTOR Skycolor[2] = { { 0.5, 0.3, 0.7 }, { 0.0, 0.0, 0.2 } };
^~~
...
It looks like the initializer sema code is confused, but it may just
be structs not being completely handled. Incidentally, it would be
nice to not emit the "excess elements" warning after the "incompatible
types" error in the case where the "incompatible types" error is not
bogus.
-Chris
More information about the cfe-dev
mailing list