summaryrefslogtreecommitdiff
path: root/clang/test/Parser/recovery.c
blob: 3916acfda1e01a8fd4b016764501eb502e6cd8d7 (about) (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
// RUN: %clang_cc1 -fsyntax-only -verify -pedantic -fblocks %s

// PR2241
float test2241[2] = { 
  1e,            // expected-error {{exponent}}
  1ee0           // expected-error {{exponent}}
};


// Testcase derived from PR2692
static void f (char * (*g) (char **, int), char **p, ...) {
  char *s;
  va_list v;                              // expected-error {{identifier}}
  s = g (p, __builtin_va_arg(v, int));    // expected-error {{identifier}}
}


// PR3172
} // expected-error {{extraneous closing brace ('}')}}


// rdar://6094870
void test(int a) {
  struct { int i; } x;
  
  if (x.hello)   // expected-error {{no member named 'hello'}}
    test(0);
  else
    ;
  
  if (x.hello == 0)   // expected-error {{no member named 'hello'}}
    test(0);
  else
    ;
  
  if ((x.hello == 0))   // expected-error {{no member named 'hello'}}
    test(0);
  else
    ;
  
  if (x.i == 0))   // expected-error {{expected expression}}
    test(0);
  else
    ;
}



char ((((                       /* expected-note {{to match this '('}} */
         *X x ] ))));                    /* expected-error {{expected ')'}} */

;   // expected-warning {{extra ';' outside of a function}}




struct S { void *X, *Y; };

struct S A = {
&BADIDENT, 0     /* expected-error {{use of undeclared identifier}} */
};

// rdar://6248081
void test6248081() { 
  [10]  // expected-error {{expected expression}}
}

struct forward; // expected-note{{forward declaration of 'struct forward'}}
void x(struct forward* x) {switch(x->a) {}} // expected-error {{incomplete definition of type}}

// PR3410
void foo() {
  int X;
  X = 4 // expected-error{{expected ';' after expression}}
}

// rdar://9045701
void test9045701(int x) {
#define VALUE 0
  x = VALUE // expected-error{{expected ';' after expression}}
}

// rdar://7980651
typedef int intptr_t;  // expected-note {{'intptr_t' declared here}}
void bar(intptr y);     // expected-error {{unknown type name 'intptr'; did you mean 'intptr_t'?}}

void test1(void) {
  int x = 2: // expected-error {{expected ';' at end of declaration}}
  int y = x;
  int z = y;
}

void test2(int x) {
#define VALUE2 VALUE+VALUE
#define VALUE3 VALUE+0
#define VALUE4(x) x+0
  x = VALUE2 // expected-error{{expected ';' after expression}}
  x = VALUE3 // expected-error{{expected ';' after expression}}
  x = VALUE4(0) // expected-error{{expected ';' after expression}}
}