xref: /minix3/external/bsd/llvm/dist/clang/test/Sema/expr-comma.c (revision f4a2713ac843a11c696ec80c0a5e3e5d80b4d338)
1*f4a2713aSLionel Sambuc // RUN: %clang_cc1 %s -fsyntax-only -verify -std=c89 -Wno-sizeof-array-decay
2*f4a2713aSLionel Sambuc // expected-no-diagnostics
3*f4a2713aSLionel Sambuc // rdar://6095180
4*f4a2713aSLionel Sambuc 
5*f4a2713aSLionel Sambuc struct s { char c[17]; };
6*f4a2713aSLionel Sambuc extern struct s foo(void);
7*f4a2713aSLionel Sambuc 
8*f4a2713aSLionel Sambuc struct s a, b, c;
9*f4a2713aSLionel Sambuc 
10*f4a2713aSLionel Sambuc int A[sizeof((foo().c)) == 17 ? 1 : -1];
11*f4a2713aSLionel Sambuc int B[sizeof((a.c)) == 17 ? 1 : -1];
12*f4a2713aSLionel Sambuc 
13*f4a2713aSLionel Sambuc 
14*f4a2713aSLionel Sambuc // comma does not promote array/function in c90 unless they are lvalues.
15*f4a2713aSLionel Sambuc int W[sizeof(0, a.c) == sizeof(char*) ? 1 : -1];
16*f4a2713aSLionel Sambuc int X[sizeof(0, (foo().c)) == 17 ? 1 : -1];
17*f4a2713aSLionel Sambuc int Y[sizeof(0, (a,b).c) == 17 ? 1 : -1];
18*f4a2713aSLionel Sambuc int Z[sizeof(0, (a=b).c) == 17 ? 1 : -1];
19