From: Chris Lattner Date: Fri, 25 Jul 2008 20:02:29 +0000 (+0000) Subject: Comma does not perform unary promotions, rdar://6095180 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=080b332959f0a1886c8d0a515f656fe6215a9ce3;p=clang 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 --- 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 +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]; + +