8sa1-gcc/gcc/testsuite/gcc.dg/Wconversion.c
Neil Booth a38b987a89 c-typeck.c (convert_arguments): When comparing for enumeral type equality, use TYPE_MAIN_VARIANT.
* c-typeck.c (convert_arguments): When comparing for enumeral
	type equality, use TYPE_MAIN_VARIANT.
	* gcc.dg/Wconversion.c: New tests.

From-SVN: r46559
2001-10-26 20:49:48 +00:00

21 lines
480 B
C

/* Source: PR 137.
We would not warn about passing an enum, but would warn about
passing a enum that was part of an array. TYPE_MAIN_VARIANT was
not used in the appropriate place in the warning code. */
/* { dg-do compile } */
/* { dg-options -Wconversion } */
typedef enum { a } __attribute__((packed)) t;
void f(t x) {}
int main(void)
{
t x[2], y;
f(x[0]); /* { dg-bogus "different width" } */
f(y); /* { dg-bogus "different width" } */
return 0;
}