diff options
author | John McCall <rjmccall@apple.com> | 2010-11-09 23:24:47 +0000 |
---|---|---|
committer | John McCall <rjmccall@apple.com> | 2010-11-09 23:24:47 +0000 |
commit | d2a5312e14e3ff1797bb821e26e6da80dc8801cc (patch) | |
tree | 8e75bbc75b99ee45969799c82c6d3595552f1edc /clang/test | |
parent | 07569be70ccda18d0c35b67b0f0432894b82b17a (diff) | |
download | bcm5719-llvm-d2a5312e14e3ff1797bb821e26e6da80dc8801cc.tar.gz bcm5719-llvm-d2a5312e14e3ff1797bb821e26e6da80dc8801cc.zip |
Add a warning for implicit truncation of constant values due to
bitfield assignment.
Implements rdar://problem/7809123
llvm-svn: 118647
Diffstat (limited to 'clang/test')
-rw-r--r-- | clang/test/Sema/constant-conversion.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/clang/test/Sema/constant-conversion.c b/clang/test/Sema/constant-conversion.c index cacd5968dc0..29571831653 100644 --- a/clang/test/Sema/constant-conversion.c +++ b/clang/test/Sema/constant-conversion.c @@ -7,3 +7,9 @@ void test_6792488(void) { int x = 0x3ff0000000000000U; // expected-warning {{implicit conversion from 'unsigned long' to 'int' changes value from 4607182418800017408 to 0}} } + +void test_7809123(void) { + struct { int i5 : 5; } a; + + a.i5 = 36; // expected-warning {{implicit truncation for 'int' to bitfield changes value from 36 to 4}} +} |