30 lines · c
1// RUN: %clang_cc1 -fsyntax-only -verify %s -std=c11 -Wno-pointer-arith -Wno-gnu-alignof-expression -Wno-unused -pedantic-errors2 3static void *a(void); // expected-error {{function 'a' has internal linkage but is not defined}}4static void *b(void); // expected-error {{function 'b' has internal linkage but is not defined}}5static void *c(void); // expected-error {{function 'c' has internal linkage but is not defined}}6static void *d(void); // expected-error {{function 'd' has internal linkage but is not defined}}7static void *no_err(void);8 9int 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 is20 // "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 case22 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}30