]> granicus.if.org Git - clang/commitdiff
Don't do integer promotions of LHS for compound shift assignment. The LHS has to...
authorChris Lattner <sabre@nondot.org>
Thu, 13 Dec 2007 07:28:16 +0000 (07:28 +0000)
committerChris Lattner <sabre@nondot.org>
Thu, 13 Dec 2007 07:28:16 +0000 (07:28 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@44993 91177308-0d34-0410-b5e6-96231b3b80d8

Sema/SemaExpr.cpp
test/Sema/shift.c [new file with mode: 0644]

index c6260344f1b083e5eb47e007b472c33418d8efe6..b48703d8a1c073abffb02c2fccd89f2dd5f84fd9 100644 (file)
@@ -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 (file)
index 0000000..d5ae5c1
--- /dev/null
@@ -0,0 +1,6 @@
+// RUN: clang -fsyntax-only %s
+
+void test() {
+  char c;
+  c <<= 14;
+}