Fariborz Jahanian | a18e70b | 2013-01-09 23:04:56 +0000 | [diff] [blame] | 1 | // RUN: %clang_cc1 -fsyntax-only -verify -triple x86_64-apple-darwin10 %s |
| 2 | // RUN: %clang_cc1 -x c++ -fsyntax-only -verify -triple x86_64-apple-darwin10 %s |
| 3 | // rdar://11577384 |
| 4 | |
| 5 | int f(int i) { |
| 6 | switch (i) { |
| 7 | case 2147483647 + 2: // expected-note {{value 2147483649 is outside the range of representable values of type 'int'}} \ |
Fariborz Jahanian | 4d8efb4 | 2013-01-11 19:33:54 +0000 | [diff] [blame^] | 8 | // expected-warning {{overflow in case constant expression results in value -2147483647}} |
Fariborz Jahanian | a18e70b | 2013-01-09 23:04:56 +0000 | [diff] [blame] | 9 | return 1; |
| 10 | case 9223372036854775807L * 4 : // expected-note {{value 36893488147419103228 is outside the range of representable values of type 'long'}} \ |
Fariborz Jahanian | 4d8efb4 | 2013-01-11 19:33:54 +0000 | [diff] [blame^] | 11 | // expected-warning {{overflow in case constant expression results in value -4}} |
Fariborz Jahanian | a18e70b | 2013-01-09 23:04:56 +0000 | [diff] [blame] | 12 | return 2; |
| 13 | case 2147483647: |
| 14 | return 0; |
| 15 | } |
| 16 | return 0; |
| 17 | } |