summaryrefslogtreecommitdiff
path: root/test/Sema/switch-1.c
diff options
context:
space:
mode:
authorFariborz Jahanian <fjahanian@apple.com>2013-01-25 17:19:07 +0000
committerFariborz Jahanian <fjahanian@apple.com>2013-01-25 17:19:07 +0000
commit78c28be6873965cce4026bbebef18c6224b5287d (patch)
treece1687bb284781b8f44f7e4e0a8f0732e95bf26d /test/Sema/switch-1.c
parente992ed1a065d857947b3969e6b779c41cc35c234 (diff)
downloadclang-78c28be6873965cce4026bbebef18c6224b5287d.tar.gz
Improve diagnsotic further on integer overflow.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@173461 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/Sema/switch-1.c')
-rw-r--r--test/Sema/switch-1.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/test/Sema/switch-1.c b/test/Sema/switch-1.c
index 50129c3ee2..4a5ded3b41 100644
--- a/test/Sema/switch-1.c
+++ b/test/Sema/switch-1.c
@@ -4,14 +4,15 @@
int f(int i) {
switch (i) {
- case 2147483647 + 2: // expected-warning {{overflow of constant expression results in value -2147483647 of type 'int'}}
+ case 2147483647 + 2: // expected-warning {{overflow in expression;result is -2147483647 with type 'int'}}
return 1;
- case 9223372036854775807L * 4: // expected-warning {{overflow of constant expression results in value -4 of type 'long'}}
+ case 9223372036854775807L * 4: // expected-warning {{overflow in expression;result is -4 with type 'long'}}
return 2;
- case (123456 *789012) + 1: // expected-warning {{overflow of constant expression results in value -1375982336 of type 'int'}}
+ case (123456 *789012) + 1: // expected-warning {{overflow in expression;result is -1375982336 with type 'int'}}
return 3;
case 2147483647:
return 0;
}
- return 0;
+ return (i, 65537) * 65537; // expected-warning {{overflow in expression;result is 131073 with type 'int'}} \
+ // expected-warning {{expression result unused}}
}