blob: e2beafe236c2a30e5138504ae76ae82cc316d7c7 [file] [log] [blame]
Benjamin Kramer054faa52013-03-29 21:43:21 +00001// RUN: %clang_cc1 %s -fsyntax-only -verify -std=c89 -Wno-sizeof-array-decay
Andy Gibbsc6e68da2012-10-19 12:44:48 +00002// expected-no-diagnostics
Chris Lattnere174acc2008-07-25 20:02:29 +00003// rdar://6095180
4
Chris Lattnere174acc2008-07-25 20:02:29 +00005struct s { char c[17]; };
Chris Lattnerf6e1e302008-07-25 20:54:07 +00006extern struct s foo(void);
Chris Lattnere174acc2008-07-25 20:02:29 +00007
Chris Lattnerf6e1e302008-07-25 20:54:07 +00008struct s a, b, c;
Chris Lattnere174acc2008-07-25 20:02:29 +00009
Chris Lattnerf6e1e302008-07-25 20:54:07 +000010int A[sizeof((foo().c)) == 17 ? 1 : -1];
11int B[sizeof((a.c)) == 17 ? 1 : -1];
12
13
Chris Lattner61f60a02008-07-25 21:33:13 +000014// comma does not promote array/function in c90 unless they are lvalues.
Douglas Gregorcb2b6622010-07-15 18:47:04 +000015int W[sizeof(0, a.c) == sizeof(char*) ? 1 : -1];
16int X[sizeof(0, (foo().c)) == 17 ? 1 : -1];
17int Y[sizeof(0, (a,b).c) == 17 ? 1 : -1];
18int Z[sizeof(0, (a=b).c) == 17 ? 1 : -1];