diff options
author | Eli Friedman <eli.friedman@gmail.com> | 2012-02-02 00:40:20 +0000 |
---|---|---|
committer | Eli Friedman <eli.friedman@gmail.com> | 2012-02-02 00:40:20 +0000 |
commit | e1ffd49165485a7485fd4ae2c52606d7ae2b753a (patch) | |
tree | da67d4ffd1df4c1a4990dcb143d3de5ee0101962 /clang/lib/Sema/SemaChecking.cpp | |
parent | 4f4e745725c01c18210a9dd22fc32420aaf81d1f (diff) | |
download | bcm5719-llvm-e1ffd49165485a7485fd4ae2c52606d7ae2b753a.tar.gz bcm5719-llvm-e1ffd49165485a7485fd4ae2c52606d7ae2b753a.zip |
Change the check for constant-conversion with width-1 bitfields so it doesn't suppress quite as many cases. Based off a testcase in the gcc testsuite.
llvm-svn: 149572
Diffstat (limited to 'clang/lib/Sema/SemaChecking.cpp')
-rw-r--r-- | clang/lib/Sema/SemaChecking.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/clang/lib/Sema/SemaChecking.cpp b/clang/lib/Sema/SemaChecking.cpp index ee044630373..9dbee1b2b3c 100644 --- a/clang/lib/Sema/SemaChecking.cpp +++ b/clang/lib/Sema/SemaChecking.cpp @@ -3758,8 +3758,8 @@ static bool AnalyzeBitFieldAssignment(Sema &S, FieldDecl *Bitfield, Expr *Init, return false; // Special-case bitfields of width 1: booleans are naturally 0/1, and - // therefore don't strictly fit into a bitfield of width 1. - if (FieldWidth == 1 && Value.getBoolValue() == TruncatedValue.getBoolValue()) + // therefore don't strictly fit into a signed bitfield of width 1. + if (FieldWidth == 1 && Value == 1) return false; std::string PrettyValue = Value.toString(10); |