aboutsummaryrefslogtreecommitdiff
path: root/lib/Sema/SemaChecking.cpp
diff options
context:
space:
mode:
authorEli Friedman <eli.friedman@gmail.com>2012-02-02 00:40:20 +0000
committerEli Friedman <eli.friedman@gmail.com>2012-02-02 00:40:20 +0000
commit34ff062936ac78142a2c0dc8d1ae6a40df456819 (patch)
treefef37d00663b17d72997ddfa7e238f938e3a2b8e /lib/Sema/SemaChecking.cpp
parentf2462be34a49e2108c9b4151f8e6d3fe1b916179 (diff)
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.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@149572 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/SemaChecking.cpp')
-rw-r--r--lib/Sema/SemaChecking.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/Sema/SemaChecking.cpp b/lib/Sema/SemaChecking.cpp
index ee04463037..9dbee1b2b3 100644
--- a/lib/Sema/SemaChecking.cpp
+++ b/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);