]> granicus.if.org Git - clang/commitdiff
Comma does not perform unary promotions, rdar://6095180
authorChris Lattner <sabre@nondot.org>
Fri, 25 Jul 2008 20:02:29 +0000 (20:02 +0000)
committerChris Lattner <sabre@nondot.org>
Fri, 25 Jul 2008 20:02:29 +0000 (20:02 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@54045 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Sema/SemaExpr.cpp
test/Sema/expr-comma.c [new file with mode: 0644]

index 4f085d2e43710f0e7a7fd31538a40cdba1695dd4..0e70c82637be35ce63dcabce7d023cd1c6abd316 100644 (file)
@@ -1894,7 +1894,7 @@ inline QualType Sema::CheckAssignmentOperands( // C99 6.5.16.1
 
 inline QualType Sema::CheckCommaOperands( // C99 6.5.17
   Expr *&lex, Expr *&rex, SourceLocation loc) {
-  UsualUnaryConversions(rex);
+  // Comma does not perform unary or binary promotions.
   return rex->getType();
 }
 
diff --git a/test/Sema/expr-comma.c b/test/Sema/expr-comma.c
new file mode 100644 (file)
index 0000000..7a601e9
--- /dev/null
@@ -0,0 +1,11 @@
+// RUN: clang %s -fsyntax-only -verify
+// rdar://6095180
+
+#include <assert.h>
+struct s { char c[17]; };
+extern struct s foo (void);
+
+// sizeof 'c' should be 17, not sizeof(char*).
+int X[sizeof(0, (foo().c)) == 17 ? 1 : -1];
+
+