blob: 3a05130eae3255d2fb27e55d249cb45c8f4af301 [file] [log] [blame]
Daniel Dunbard7d5f022009-03-24 02:24:46 +00001// RUN: clang-cc %s -fsyntax-only -verify -std=c89
Chris Lattner080b3322008-07-25 20:02:29 +00002// rdar://6095180
3
Chris Lattner080b3322008-07-25 20:02:29 +00004struct s { char c[17]; };
Chris Lattner53fcaa92008-07-25 20:54:07 +00005extern struct s foo(void);
Chris Lattner080b3322008-07-25 20:02:29 +00006
Chris Lattner53fcaa92008-07-25 20:54:07 +00007struct s a, b, c;
Chris Lattner080b3322008-07-25 20:02:29 +00008
Chris Lattner53fcaa92008-07-25 20:54:07 +00009int A[sizeof((foo().c)) == 17 ? 1 : -1];
10int B[sizeof((a.c)) == 17 ? 1 : -1];
11
12
Chris Lattner67d33d82008-07-25 21:33:13 +000013// comma does not promote array/function in c90 unless they are lvalues.
14int W[sizeof(0, a.c) == sizeof(char*) ? 1 : -1];
15int X[sizeof(0, (foo().c)) == 17 ? 1 : -1];
16int Y[sizeof(0, (a,b).c) == 17 ? 1 : -1];
17int Z[sizeof(0, (a=b).c) == 17 ? 1 : -1];