1f4a2713aSLionel Sambuc // RUN: %clang_cc1 %s -fsyntax-only -verify -std=c99 -Wno-sizeof-array-decay 2f4a2713aSLionel Sambuc // rdar://6095180 3f4a2713aSLionel Sambuc 4f4a2713aSLionel Sambuc struct s { char c[17]; }; 5f4a2713aSLionel Sambuc extern struct s foo(void); 6f4a2713aSLionel Sambuc 7f4a2713aSLionel Sambuc struct s a, b, c; 8f4a2713aSLionel Sambuc 9f4a2713aSLionel Sambuc int A[sizeof((foo().c)) == 17 ? 1 : -1]; 10f4a2713aSLionel Sambuc int B[sizeof((a.c)) == 17 ? 1 : -1]; 11f4a2713aSLionel Sambuc 12f4a2713aSLionel Sambuc 13f4a2713aSLionel Sambuc // comma does array/function promotion in c99. 14f4a2713aSLionel Sambuc int X[sizeof(0, (foo().c)) == sizeof(char*) ? 1 : -1]; 15f4a2713aSLionel Sambuc int Y[sizeof(0, (a,b).c) == sizeof(char*) ? 1 : -1]; 16*0a6a1f1dSLionel Sambuc int Z[sizeof(0, (a=b).c) == sizeof(char*) ? 1 : -1]; // expected-warning {{expression with side effects has no effect in an unevaluated context}} 17f4a2713aSLionel Sambuc 18