[cfe-commits] r93362 - in /cfe/trunk: lib/Sema/Sema.cpp test/Sema/anonymous-struct-union.c test/Sema/enum.c

Chris Lattner clattner at apple.com
Thu Jan 14 09:48:57 PST 2010


On Jan 13, 2010, at 2:07 PM, John McCall wrote:

> +++ cfe/trunk/test/Sema/enum.c Wed Jan 13 16:07:44 2010
> @@ -84,3 +84,11 @@
> static enum e1 badfunc(struct s1 *q) {
>   return q->bar();
> }
> +
> +
> +// Make sure we don't a.k.a. anonymous enums.
> +typedef enum {
> +  an_enumerator = 20
> +} an_enum;
> +// FIXME: why is this only a warning?
> +char * s = (an_enum) an_enumerator; // expected-warning  
> {{incompatible integer to pointer conversion initializing 'an_enum',  
> expected 'char *'}}

In response to the fixme, GCC handles int -> pointer conversions as  
warnings in C mode.

int *X = 4;

Enums follow the same rule.

-Chris



More information about the cfe-commits mailing list