blob: 2c9595c50e46630364d538e73d1b616f6a8ea78e [file] [log] [blame]
Steve Naroffc7c66532007-12-05 04:00:10 +00001// RUN: clang -fsyntax-only -verify %s
2
3struct foo { int a, b; };
4
Steve Narofff91f9722008-01-09 00:05:37 +00005static 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
Steve Naroffc7c66532007-12-05 04:00:10 +000011extern void fooFunc(struct foo *pfoo);
12
13int main(int argc, char **argv) {
14 fooFunc(&(struct foo){ 1, 2 });
15}
16
Steve Narofff91f9722008-01-09 00:05:37 +000017