blob: efc934d57a54b47ae5d3a1ef865fd78d56a8aa4e [file] [log] [blame]
Chris Lattner4ef8dd62007-11-01 02:45:17 +00001// RUN: clang %s -verify -fsyntax-only
2
3typedef void (* fp)(void);
4void foo(void);
5fp a[1] = { foo };
6
Chris Lattner4cc62712007-11-27 21:35:27 +00007int myArray[5] = {1, 2, 3, 4, 5};
8int *myPointer2 = myArray;
9int *myPointer = &(myArray[2]);
10
Chris Lattnerd411e042007-12-02 07:47:49 +000011
12extern int x;
13void *g = &x;
14int *h = &x;
15
Eli Friedmana312ce22008-02-08 00:48:24 +000016int test() {
17int a[10];
18int b[10] = a; // expected-error {{initialization with "{...}" expected}}
19}
Chris Lattnerbe34ac62008-05-04 01:13:36 +000020
21
22// PR2050
23struct cdiff_cmd {
24 const char *name;
25 unsigned short argc;
26 int (*handler)();
27};
28int cdiff_cmd_open();
29struct cdiff_cmd commands[] = {
30 {"OPEN", 1, &cdiff_cmd_open }
31};
32
Eli Friedman97c0a392008-05-21 03:39:11 +000033// PR2348
34static struct { int z; } s[2];
35int *t = &(*s).z;
36
37// PR2349
38short *a2(void)
39{
40 short int b;
41 static short *bp = &b; // expected-error {{initializer element is not constant}}
42
43 return bp;
44}
Eli Friedmanf8f873d2008-05-30 18:07:22 +000045
46int pbool(void) {
47 typedef const _Bool cbool;
48 _Bool pbool1 = (void *) 0;
49 cbool pbool2 = &pbool;
50 return pbool2;
51}
52