blob: 934c81cfa0b087c7b6ddde5368b90e564985f577 [file] [log] [blame]
Benjamin Kramer054faa52013-03-29 21:43:21 +00001// RUN: %clang_cc1 %s -fsyntax-only -verify -std=c99 -Wno-sizeof-array-decay
Chris Lattner61f60a02008-07-25 21:33:13 +00002// rdar://6095180
3
Chris Lattner61f60a02008-07-25 21:33:13 +00004struct 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 array/function promotion in c99.
Douglas Gregorcb2b6622010-07-15 18:47:04 +000014int X[sizeof(0, (foo().c)) == sizeof(char*) ? 1 : -1];
15int Y[sizeof(0, (a,b).c) == sizeof(char*) ? 1 : -1];
Aaron Ballman6c93b3e2014-12-17 21:57:17 +000016int Z[sizeof(0, (a=b).c) == sizeof(char*) ? 1 : -1]; // expected-warning {{expression with side effects has no effect in an unevaluated context}}
Chris Lattner61f60a02008-07-25 21:33:13 +000017