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