| 1 |
// RUN: %clang_cc1 -fsyntax-only -verify %s -std=c11 -Wno-pointer-arith -Wno-gnu-alignof-expression -Wno-unused -pedantic-errors |
| 2 |
|
| 3 |
static void *a(void); // expected-error {{function 'a' has internal linkage but is not defined}} |
| 4 |
static void *b(void); // expected-error {{function 'b' has internal linkage but is not defined}} |
| 5 |
static void *c(void); // expected-error {{function 'c' has internal linkage but is not defined}} |
| 6 |
static void *d(void); // expected-error {{function 'd' has internal linkage but is not defined}} |
| 7 |
static void *no_err(void); |
| 8 |
|
| 9 |
int main(void) |
| 10 |
{ |
| 11 |
a; // expected-note {{used here}} |
| 12 |
|
| 13 |
int i = _Alignof(no_err); |
| 14 |
|
| 15 |
int j = _Generic(&no_err, void *(*)(void): 0); |
| 16 |
|
| 17 |
void *k = _Generic(&no_err, void *(*)(void): b(), default: 0); // expected-note {{used here}} |
| 18 |
|
| 19 |
// FIXME according to the C standard there should be no error if the undefined internal is |
| 20 |
// "part of the expression in a generic association that is not the result expression of its generic selection;" |
| 21 |
// but, currently, clang wrongly emits an error in this case |
| 22 |
k = _Generic(&no_err, void *(*)(void): 0, default: c()); // expected-note {{used here}} |
| 23 |
|
| 24 |
k = _Generic(&no_err, int (*)(void) : 0, default : d()); // expected-note {{used here}} |
| 25 |
|
| 26 |
int l = sizeof(no_err); |
| 27 |
|
| 28 |
__typeof__(&no_err) x; |
| 29 |
} |