[cfe-dev] Likely bug with C++ and cast from incomplete type to void *

Abramo Bagnara abramo.bagnara at gmail.com
Tue Aug 3 06:03:26 PDT 2010


It seems that clang when compiling this tiny source in C++ mode refuses
to cast void*(*)[] to void*.

The code is compiled without troubles in gcc, intel compiler and comeau.

$ cat bug.c
extern void* x[];
void* dummy[] = { &x };
$ gcc -x c -c bug.c
$ gcc -x c++ -c bug.c
$ clang -x c -c bug.c
$ clang -x c++ -c bug.c
bug.c:2:19: error: cannot initialize an array element of type 'void *'
with an
      rvalue of type 'void *(*)[]'
void* dummy[] = { &x };
                  ^~
1 error generated.




More information about the cfe-dev mailing list