summaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.dg/warn/overflow-warn-5.C
blob: bdfec4a6be19c1cc559d54457b18b4f52fd101ff (plain)
1
2
3
4
5
6
7
8
9
10
11
/* PR c/27273 */
/* { dg-do compile } */

// This used to warn about "overflow in implicit constant conversion",
// which was wrong; 512 is never converted to unsigned char.  Rather, an
// appropriate warning would be that the & expression always evaluates to 0
// because of the limited range of unsigned char.

unsigned char rx_async(unsigned char p) {
    return p & 512; /* { dg-warning "" "" { xfail *-*-* } } */
}