]> gcc.gnu.org Git - gcc.git/blame - gcc/testsuite/g++.dg/cpp0x/Wnarrowing17.C
PR c++/92590 - wrong handling of inherited default ctor.
[gcc.git] / gcc / testsuite / g++.dg / cpp0x / Wnarrowing17.C
CommitLineData
f339eb66
MP
1// PR c++/90805 - detect narrowing in case values.
2// { dg-do compile { target c++11 } }
3
4void f(int i, char c, unsigned u)
5{
6 switch (i)
7 {
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 }
11 }
12
13 switch (c)
14 // No narrowing, the adjusted type is int.
15 case 300:; // { dg-warning "exceeds maximum value for type" }
16
17 switch (u)
18 case -42:; // { dg-error "narrowing conversion of .-42. from .int. to .unsigned int." }
19}
This page took 0.452363 seconds and 5 git commands to generate.