blob: 02886bff053f1850deb3008dfd5223309e34f23f [file] [log] [blame]
Benjamin Kramer52b2e702013-03-29 21:43:21 +00001// RUN: %clang_cc1 %s -fsyntax-only -verify -std=c99 -Wno-sizeof-array-decay
Andy Gibbs8e8fb3b2012-10-19 12:44:48 +00002// expected-no-diagnostics
Chris Lattner67d33d82008-07-25 21:33:13 +00003// rdar://6095180
4
Chris Lattner67d33d82008-07-25 21:33:13 +00005struct s { char c[17]; };
6extern struct s foo(void);
7
8struct s a, b, c;
9
10int A[sizeof((foo().c)) == 17 ? 1 : -1];
11int B[sizeof((a.c)) == 17 ? 1 : -1];
12
13
14// comma does array/function promotion in c99.
Douglas Gregor35e12c92010-07-15 18:47:04 +000015int X[sizeof(0, (foo().c)) == sizeof(char*) ? 1 : -1];
16int Y[sizeof(0, (a,b).c) == sizeof(char*) ? 1 : -1];
17int Z[sizeof(0, (a=b).c) == sizeof(char*) ? 1 : -1];
Chris Lattner67d33d82008-07-25 21:33:13 +000018