Home | History | Annotate | Download | only in Sema
      1 // RUN: %clang_cc1 -fsyntax-only -verify %s
      2 //
      3 // This file contains typo correction tests which hit different code paths in C
      4 // than in C++ and may exhibit different behavior as a result.
      5 
      6 __typeof__(struct F*) var[invalid];  // expected-error-re {{use of undeclared identifier 'invalid'{{$}}}}
      7 
      8 void PR21656() {
      9   float x;
     10   x = (float)arst;  // expected-error-re {{use of undeclared identifier 'arst'{{$}}}}
     11 }
     12 
     13 a = b ? : 0;  // expected-warning {{type specifier missing, defaults to 'int'}} \
     14               // expected-error {{use of undeclared identifier 'b'}}
     15 
     16 int foobar;  // expected-note {{'foobar' declared here}}
     17 a = goobar ?: 4;  // expected-warning {{type specifier missing, defaults to 'int'}} \
     18                   // expected-error {{use of undeclared identifier 'goobar'; did you mean 'foobar'?}} \
     19                   // expected-error {{initializer element is not a compile-time constant}}
     20 
     21 struct ContainerStuct {
     22   enum { SOME_ENUM }; // expected-note {{'SOME_ENUM' declared here}}
     23 };
     24 
     25 void func(int arg) {
     26   switch (arg) {
     27   case SOME_ENUM_: // expected-error {{use of undeclared identifier 'SOME_ENUM_'; did you mean 'SOME_ENUM'}}
     28     ;
     29   }
     30 }
     31 
     32 void banana(void);  // expected-note {{'banana' declared here}}
     33 int c11Generic(int arg) {
     34   _Generic(hello, int : banana)();  // expected-error-re {{use of undeclared identifier 'hello'{{$}}}}
     35   _Generic(arg, int : bandana)();  // expected-error {{use of undeclared identifier 'bandana'; did you mean 'banana'?}}
     36 }
     37