summaryrefslogtreecommitdiff
path: root/gcc/testsuite/c-c++-common/pr51712.c
blob: 69e316d24521834a5f31aad89b68969b7ec9fe6b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
/* PR c/51712 */
/* { dg-do compile } */
/* { dg-options "-Wtype-limits" } */
/* { dg-additional-options "-fno-short-enums" { target short_enums } } */

enum test_enum {
  FOO,
  BAR
};

int valid(enum test_enum arg)
{
  return arg >= 0 && arg <= BAR;
}

int valid2(unsigned int arg2)
{
  return arg2 >= FOO && arg2 <= BAR; /* { dg-bogus "comparison of unsigned expression" "" { xfail *-*-* } } */
}