aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2008-07-25 20:02:29 +0000
committerChris Lattner <sabre@nondot.org>2008-07-25 20:02:29 +0000
commit080b332959f0a1886c8d0a515f656fe6215a9ce3 (patch)
treeec40fa0f181dc6bda7c7ed2685bad3a60f9e071a
parent3872b5cadd63649c12dd41bca786b67327618462 (diff)
Comma does not perform unary promotions, rdar://6095180
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@54045 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--lib/Sema/SemaExpr.cpp2
-rw-r--r--test/Sema/expr-comma.c11
2 files changed, 12 insertions, 1 deletions
diff --git a/lib/Sema/SemaExpr.cpp b/lib/Sema/SemaExpr.cpp
index 4f085d2e43..0e70c82637 100644
--- a/lib/Sema/SemaExpr.cpp
+++ b/lib/Sema/SemaExpr.cpp
@@ -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
index 0000000000..7a601e9b3d
--- /dev/null
+++ b/test/Sema/expr-comma.c
@@ -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];
+
+