summaryrefslogtreecommitdiffstats
path: root/clang/test/Sema/constant-conversion.c
diff options
context:
space:
mode:
Diffstat (limited to 'clang/test/Sema/constant-conversion.c')
-rw-r--r--clang/test/Sema/constant-conversion.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/clang/test/Sema/constant-conversion.c b/clang/test/Sema/constant-conversion.c
index 7c6b9b81bd0..a2c48d3549c 100644
--- a/clang/test/Sema/constant-conversion.c
+++ b/clang/test/Sema/constant-conversion.c
@@ -55,3 +55,10 @@ void test5() {
// don't warn about it just because it's a bitfield.
a.b = 100;
}
+
+void test6() {
+ // Test that unreachable code doesn't trigger the truncation warning.
+ unsigned char x = 0 ? 65535 : 1; // no-warning
+ unsigned char y = 1 ? 65535 : 1; // expected-warning {{changes value}}
+}
+
OpenPOWER on IntegriCloud