view gcc/testsuite/g++.dg/warn/overflow-warn-5.C @ 131:84e7813d76e9

gcc-8.2
author mir3636
date Thu, 25 Oct 2018 07:37:49 +0900
parents 04ced10e8804
children
line wrap: on
line source

/* 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 *-*-* } } */
}