[cfe-dev] Issue with designated initializers and vectors
Mattias Holm
holm at liacs.nl
Sat Jun 13 02:58:38 PDT 2009
The following code fails in clang:
typedef float __attribute__((vector_size (16))) v4f_t;
typedef union {
struct {
float x, y, z, w;
}s;
v4f_t v;
} vector_t;
vector_t foo(v4f_t p)
{
vector_t v = {.v = p};
return v;
}
europa:test holm$ clang -std=gnu99 -c test.c
test.c:13:22: error: incompatible type initializing 'v4f_t', expected
'float'
vector_t v = {.v = p};
^
I might be missing options to make this work, if so what flags should I
add to clang (I want to support clang in my makefiles for my project as
an optional compiler). The code builds fine with gcc and the same options.
Regards,
Mattias
More information about the cfe-dev
mailing list