switch-1.c revision ad48a500596d7d678b99c7f94326cfa856c3b49f
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
5int f(int i) {
6  switch (i) {
7    case 2147483647 + 2: // expected-warning {{overflow in case constant expression results in value -2147483647 of type 'int'}}
8      return 1;
9    case 9223372036854775807L * 4: // expected-warning {{overflow in case constant expression results in value -4 of type 'long'}}
10      return 2;
11    case (123456 *789012) + 1:  // expected-warning {{overflow in case constant expression results in value -1375982336 of type 'int'}}
12      return 3;
13    case 2147483647:
14      return 0;
15  }
16  return 0;
17}
18