1 // PR c++/90805 - detect narrowing in case values.
2 // { dg-do compile { target c++11 } }
4 void f(int i, char c, unsigned u)
8 case 2149056512u:; // { dg-error "narrowing conversion of .2149056512. from .unsigned int. to .int." }
9 case (long long int) 1e10:; // { dg-error "narrowing conversion of .10000000000. from .long long int. to .int." }
10 // { dg-warning "overflow in conversion" "overflow" { target *-*-* } .-1 }
14 // No narrowing, the adjusted type is int.
15 case 300:; // { dg-warning "exceeds maximum value for type" }
18 case -42:; // { dg-error "narrowing conversion of .-42. from .int. to .unsigned int." }