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 // rdar://13423975 5 6 int f(int i) { 7 switch (i) { 8 case 2147483647 + 2: // expected-warning {{overflow in expression; result is -2147483647 with type 'int'}} 9 return 1; 10 case 9223372036854775807L * 4: // expected-warning {{overflow in expression; result is -4 with type 'long'}} 11 return 2; 12 case (123456 *789012) + 1: // expected-warning {{overflow in expression; result is -1375982336 with type 'int'}} 13 return 3; 14 case (2147483647*4)/4: // expected-warning {{overflow in expression; result is -4 with type 'int'}} 15 case (2147483647*4)%4: // expected-warning {{overflow in expression; result is -4 with type 'int'}} 16 return 4; 17 case 2147483647: 18 return 0; 19 } 20 return (i, 65537) * 65537; // expected-warning {{overflow in expression; result is 131073 with type 'int'}} \ 21 // expected-warning {{expression result unused}} 22 } 23