[cfe-commits] r54045 - in /cfe/trunk: lib/Sema/SemaExpr.cpp test/Sema/expr-comma.c
Chris Lattner
sabre at nondot.org
Fri Jul 25 13:02:30 PDT 2008
Author: lattner
Date: Fri Jul 25 15:02:29 2008
New Revision: 54045
URL: http://llvm.org/viewvc/llvm-project?rev=54045&view=rev
Log:
Comma does not perform unary promotions, rdar://6095180
Added:
cfe/trunk/test/Sema/expr-comma.c
Modified:
cfe/trunk/lib/Sema/SemaExpr.cpp
Modified: cfe/trunk/lib/Sema/SemaExpr.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaExpr.cpp?rev=54045&r1=54044&r2=54045&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaExpr.cpp (original)
+++ cfe/trunk/lib/Sema/SemaExpr.cpp Fri Jul 25 15:02:29 2008
@@ -1894,7 +1894,7 @@
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();
}
Added: cfe/trunk/test/Sema/expr-comma.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Sema/expr-comma.c?rev=54045&view=auto
==============================================================================
--- cfe/trunk/test/Sema/expr-comma.c (added)
+++ cfe/trunk/test/Sema/expr-comma.c Fri Jul 25 15:02:29 2008
@@ -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];
+
+
More information about the cfe-commits
mailing list