aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/c-c++-common/pr103881.c
blob: bb3f53bcf7ba1955b24f4afc3b869b51adb3f034 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
/* PR c/103881 */
/* { dg-do compile } */
/* { dg-options "-Wconversion" } */

unsigned char bar (void);

void
foo (void)
{
  unsigned char t = 0;
  t |= bar ();
  t |= bar () & bar ();	/* { dg-bogus "conversion from 'int' to 'unsigned char' may change value" "" { xfail c++ } } */
  t &= bar () & bar ();	/* { dg-bogus "conversion from 'int' to 'unsigned char' may change value" "" { xfail c++ } } */
  t = bar () & bar ();

  unsigned char a = bar ();
  t |= a & a;
  t |= bar () & a;		/* { dg-bogus "conversion from 'int' to 'unsigned char' may change value" "" { xfail c++ } } */
  t |= a & bar ();		/* { dg-bogus "conversion from 'int' to 'unsigned char' may change value" "" { xfail c++ } } */
}