recovery.c 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  1. // RUN: %clang_cc1 -fsyntax-only -verify -pedantic -fblocks %s
  2. // PR2241
  3. float test2241[2] = {
  4. 1e, // expected-error {{exponent}}
  5. 1ee0 // expected-error {{exponent}}
  6. };
  7. // Testcase derived from PR2692
  8. static void f (char * (*g) (char **, int), char **p, ...) {
  9. char *s;
  10. va_list v; // expected-error {{identifier}}
  11. s = g (p, __builtin_va_arg(v, int)); // expected-error {{identifier}}
  12. }
  13. // PR3172
  14. } // expected-error {{extraneous closing brace ('}')}}
  15. // rdar://6094870
  16. void test(int a) {
  17. struct { int i; } x;
  18. if (x.hello) // expected-error {{no member named 'hello'}}
  19. test(0);
  20. else
  21. ;
  22. if (x.hello == 0) // expected-error {{no member named 'hello'}}
  23. test(0);
  24. else
  25. ;
  26. if ((x.hello == 0)) // expected-error {{no member named 'hello'}}
  27. test(0);
  28. else
  29. ;
  30. // PR12595
  31. if (x.i == 0)) // expected-error {{extraneous ')' after condition, expected a statement}}
  32. test(0);
  33. else
  34. ;
  35. }
  36. char (((( /* expected-note {{to match this '('}} */
  37. *X x ] )))); /* expected-error {{expected ')'}} */
  38. ; // expected-warning {{extra ';' outside of a function}}
  39. struct S { void *X, *Y; };
  40. struct S A = {
  41. &BADIDENT, 0 /* expected-error {{use of undeclared identifier}} */
  42. };
  43. // rdar://6248081
  44. void test6248081() {
  45. [10] // expected-error {{expected expression}}
  46. }
  47. struct forward; // expected-note{{forward declaration of 'struct forward'}}
  48. void x(struct forward* x) {switch(x->a) {}} // expected-error {{incomplete definition of type}}
  49. // PR3410
  50. void foo() {
  51. int X;
  52. X = 4 // expected-error{{expected ';' after expression}}
  53. }
  54. // rdar://9045701
  55. void test9045701(int x) {
  56. #define VALUE 0
  57. x = VALUE // expected-error{{expected ';' after expression}}
  58. }
  59. // rdar://7980651
  60. typedef int intptr_t; // expected-note {{'intptr_t' declared here}}
  61. void bar(intptr y); // expected-error {{unknown type name 'intptr'; did you mean 'intptr_t'?}}
  62. void test1(void) {
  63. int x = 2: // expected-error {{expected ';' at end of declaration}}
  64. int y = x;
  65. int z = y;
  66. }
  67. void test2(int x) {
  68. #define VALUE2 VALUE+VALUE
  69. #define VALUE3 VALUE+0
  70. #define VALUE4(x) x+0
  71. x = VALUE2 // expected-error{{expected ';' after expression}}
  72. x = VALUE3 // expected-error{{expected ';' after expression}}
  73. x = VALUE4(0) // expected-error{{expected ';' after expression}}
  74. }