blob: 849e8d5ae8b51f7658b67a32a6961098b3b48e5e [file] [log] [blame]
Chris Lattner67d33d82008-07-25 21:33:13 +00001// RUN: clang %s -fsyntax-only -verify -std=c89
Chris Lattner080b3322008-07-25 20:02:29 +00002// rdar://6095180
3
4#include <assert.h>
5struct s { char c[17]; };
Chris Lattner53fcaa92008-07-25 20:54:07 +00006extern struct s foo(void);
Chris Lattner080b3322008-07-25 20:02:29 +00007
Chris Lattner53fcaa92008-07-25 20:54:07 +00008struct s a, b, c;
Chris Lattner080b3322008-07-25 20:02:29 +00009
Chris Lattner53fcaa92008-07-25 20:54:07 +000010int A[sizeof((foo().c)) == 17 ? 1 : -1];
11int B[sizeof((a.c)) == 17 ? 1 : -1];
12
13
Chris Lattner67d33d82008-07-25 21:33:13 +000014// comma does not promote array/function in c90 unless they are lvalues.
15int 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];