diff options
author | Chris Lattner <sabre@nondot.org> | 2007-12-13 07:28:16 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2007-12-13 07:28:16 +0000 |
commit | 1dcf2c8c3bd00c3b10ea8f0b9f3f0ac6714d1b09 (patch) | |
tree | 6b50f65585eb4ff745289ed8a854ff504a869aa5 | |
parent | e0cbae4cdecdfeae3c559f2d90664e59129cdf92 (diff) |
Don't do integer promotions of LHS for compound shift assignment. The LHS has to be a modifiable lvalue.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@44993 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | Sema/SemaExpr.cpp | 3 | ||||
-rw-r--r-- | test/Sema/shift.c | 6 |
2 files changed, 8 insertions, 1 deletions
diff --git a/Sema/SemaExpr.cpp b/Sema/SemaExpr.cpp index c6260344f1..b48703d8a1 100644 --- a/Sema/SemaExpr.cpp +++ b/Sema/SemaExpr.cpp @@ -1321,7 +1321,8 @@ inline QualType Sema::CheckShiftOperands( // C99 6.5.7 // Shifts don't perform usual arithmetic conversions, they just do integer // promotions on each operand. C99 6.5.7p3 - UsualUnaryConversions(lex); + if (!isCompAssign) + UsualUnaryConversions(lex); UsualUnaryConversions(rex); // "The type of the result is that of the promoted left operand." diff --git a/test/Sema/shift.c b/test/Sema/shift.c new file mode 100644 index 0000000000..d5ae5c1e90 --- /dev/null +++ b/test/Sema/shift.c @@ -0,0 +1,6 @@ +// RUN: clang -fsyntax-only %s + +void test() { + char c; + c <<= 14; +} |