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

Chris Lattner clattner at apple.com
Tue Aug 3 09:35:45 PDT 2010


On Aug 3, 2010, at 6:03 AM, Abramo Bagnara wrote:

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

Hi Abramo,

Please file a bugzilla for this and the -Wunreachable-code issue, thanks!

-Chris

> 
> 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.
> 
> _______________________________________________
> 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