compound-literal.c revision b8f13a8baff3df080fe024fec47746e9a79fe649
1// RUN: clang -fsyntax-only -verify %s 2 3struct foo { int a, b; }; 4 5static struct foo t = (struct foo){0,0}; // -expected-error {{initializer element is not constant}} 6static struct foo t2 = {0,0}; 7static struct foo t3 = t2; // -expected-error {{initializer element is not constant}} 8static int *p = (int []){2,4}; 9static int x = (int){1}; // -expected-error {{initializer element is not constant}} -expected-warning{{braces around scalar initializer}} 10 11extern void fooFunc(struct foo *pfoo); 12 13int main(int argc, char **argv) { 14 fooFunc(&(struct foo){ 1, 2 }); 15} 16 17 18