summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/Wenum-conversion.c
blob: 86033399b7db24031d195cdfd8bec3795a3e874f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
/* { dg-do compile } */
/* { dg-options "-Wenum-conversion" } */

enum X { x1, x2 };
enum Y { y1, y2 };

enum X obj = y1;  /* { dg-warning "implicit conversion from .enum Y. to .enum X." } */
enum Y obj2 = y1;

enum X obj3;
void foo()
{
  obj3 = y2; /* { dg-warning "implicit conversion from .enum Y. to .enum X." } */
}

void bar(enum X);
void f(void)
{
  bar (y1); /* { dg-warning "implicit conversion from .enum Y. to .enum X." } */
}