expr-comma.c revision 35e12c90c1b107a75c5615aa76fdbd403661aaa6
1// RUN: %clang_cc1 %s -fsyntax-only -verify -std=c89
2// rdar://6095180
3
4struct s { char c[17]; };
5extern struct s foo(void);
6
7struct s a, b, c;
8
9int A[sizeof((foo().c)) == 17 ? 1 : -1];
10int B[sizeof((a.c)) == 17 ? 1 : -1];
11
12
13// comma does not promote array/function in c90 unless they are lvalues.
14int W[sizeof(0, a.c) == sizeof(char*) ? 1 : -1];
15int X[sizeof(0, (foo().c)) == 17 ? 1 : -1];
16int Y[sizeof(0, (a,b).c) == 17 ? 1 : -1];
17int Z[sizeof(0, (a=b).c) == 17 ? 1 : -1];
18