| 1 |
/* { dg-do compile } */ |
| 2 |
/* { dg-options "-Wconversion -fno-trapping-math" } */ |
| 3 |
|
| 4 |
typedef char T; |
| 5 |
|
| 6 |
void g() |
| 7 |
{ |
| 8 |
char c = 300; /* { dg-warning "conversion from .int. to .char. changes value from .300. to .44." } */ |
| 9 |
T t = 300; /* { dg-warning "conversion from .int. to .T. {aka .char.} changes value from .300. to .44." } */ |
| 10 |
signed char sc = 300; /* { dg-warning "conversion from .int. to .signed char. changes value from .300. to .44." } */ |
| 11 |
unsigned char uc = 300; /* { dg-warning "conversion from .int. to .unsigned char. changes value from .300. to .44." } */ |
| 12 |
unsigned char uc2 = 300u; /* { dg-warning "conversion from .unsigned int. to .unsigned char. changes value from .300. to .44." } */ |
| 13 |
signed char c2 = (double)1.0 + 200; /* { dg-warning "overflow in conversion from .double. to .signed char. changes value from .2.01e\\+2. to .127." } */ |
| 14 |
} |