[cfe-dev] Does your cfe consider this code in error?

Steve Naroff snaroff at apple.com
Sun Jun 1 14:54:37 PDT 2008


I just noticed that GCC does complain if the "char *" is the topmost  
cast.

[steve-naroffs-imac:llvm/tools/clang] snaroff% ../../Debug/bin/clang  
ary.c
ary.c:3:16: error: size of array has non-integer type 'char *'
   char control[(char *)2];
                ^~~~~~~~~

Looks like it could be a GCC bug related to how it does constant  
folding...

snaroff

On Jun 1, 2008, at 2:46 PM, Steve Naroff wrote:

> clang and EDG reject the following code (GCC accepts it),
>
> struct {
>   char control[((int)(char *)2)];
> } xx;
>
> What about your cfe?
>
> Thanks,
>
> snaroff
> _______________________________________________
> 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