2014-11-22 02:48:04 +08:00
|
|
|
// RUN: %clang_cc1 -fsyntax-only -verify %s
|
|
|
|
//
|
|
|
|
// This file contains typo correction tests which hit different code paths in C
|
|
|
|
// than in C++ and may exhibit different behavior as a result.
|
|
|
|
|
|
|
|
__typeof__(struct F*) var[invalid]; // expected-error-re {{use of undeclared identifier 'invalid'{{$}}}}
|
2014-11-25 05:46:59 +08:00
|
|
|
|
|
|
|
void PR21656() {
|
|
|
|
float x;
|
|
|
|
x = (float)arst; // expected-error-re {{use of undeclared identifier 'arst'{{$}}}}
|
|
|
|
}
|
2015-01-08 05:16:39 +08:00
|
|
|
|
|
|
|
a = b ? : 0; // expected-warning {{type specifier missing, defaults to 'int'}} \
|
|
|
|
// expected-error {{use of undeclared identifier 'b'}}
|
2015-01-09 17:37:26 +08:00
|
|
|
|
2015-01-28 02:26:18 +08:00
|
|
|
int foobar; // expected-note {{'foobar' declared here}}
|
|
|
|
a = goobar ?: 4; // expected-warning {{type specifier missing, defaults to 'int'}} \
|
|
|
|
// expected-error {{use of undeclared identifier 'goobar'; did you mean 'foobar'?}} \
|
|
|
|
// expected-error {{initializer element is not a compile-time constant}}
|
|
|
|
|
2015-01-09 17:37:26 +08:00
|
|
|
struct ContainerStuct {
|
|
|
|
enum { SOME_ENUM }; // expected-note {{'SOME_ENUM' declared here}}
|
|
|
|
};
|
|
|
|
|
|
|
|
void func(int arg) {
|
|
|
|
switch (arg) {
|
2015-01-09 17:42:32 +08:00
|
|
|
case SOME_ENUM_: // expected-error {{use of undeclared identifier 'SOME_ENUM_'; did you mean 'SOME_ENUM'}}
|
|
|
|
;
|
2015-01-09 17:37:26 +08:00
|
|
|
}
|
|
|
|
}
|
2015-03-20 04:56:07 +08:00
|
|
|
|
|
|
|
void banana(void); // expected-note {{'banana' declared here}}
|
|
|
|
int c11Generic(int arg) {
|
|
|
|
_Generic(hello, int : banana)(); // expected-error-re {{use of undeclared identifier 'hello'{{$}}}}
|
|
|
|
_Generic(arg, int : bandana)(); // expected-error {{use of undeclared identifier 'bandana'; did you mean 'banana'?}}
|
|
|
|
}
|
2015-05-02 03:36:25 +08:00
|
|
|
|
|
|
|
typedef long long __m128i __attribute__((__vector_size__(16)));
|
|
|
|
int PR23101(__m128i __x) {
|
|
|
|
return foo((__v2di)__x); // expected-warning {{implicit declaration of function 'foo'}} \
|
|
|
|
// expected-error {{use of undeclared identifier '__v2di'}}
|
|
|
|
}
|
2015-06-24 02:42:21 +08:00
|
|
|
|
|
|
|
void f(long *a, long b) {
|
|
|
|
__atomic_or_fetch(a, b, c); // expected-error {{use of undeclared identifier 'c'}}
|
|
|
|
}
|
2015-06-24 03:13:17 +08:00
|
|
|
|
|
|
|
extern double cabs(_Complex double z);
|
|
|
|
void fn1() {
|
|
|
|
cabs(errij); // expected-error {{use of undeclared identifier 'errij'}}
|
|
|
|
}
|
2015-08-20 21:11:14 +08:00
|
|
|
|
|
|
|
extern long afunction(int); // expected-note {{'afunction' declared here}}
|
|
|
|
void fn2() {
|
|
|
|
f(THIS_IS_AN_ERROR, // expected-error {{use of undeclared identifier 'THIS_IS_AN_ERROR'}}
|
|
|
|
afunction(afunction_)); // expected-error {{use of undeclared identifier 'afunction_'; did you mean 'afunction'?}}
|
|
|
|
}
|