24 lines · c
1// RUN: %clang_cc1 -verify -std=c2y -Wall -pedantic %s2 3/* WG14 N3347: Yes4 * Slay Some Earthly Demons IX5 *6 * Declarations of a tentative definition with internal linkage must be7 * complete by the end of the translation unit.8 */9 10struct foo; // #foo11static struct foo f1; /* expected-warning {{tentative definition of variable with internal linkage has incomplete non-array type 'struct foo'}}12 expected-error {{tentative definition has type 'struct foo' that is never completed}}13 expected-note@#foo 2 {{forward declaration of 'struct foo'}}14 */15 16extern struct foo f2; // Ok, does not have internal linkage17 18struct bar; // #bar19static struct bar b; /* expected-warning {{tentative definition of variable with internal linkage has incomplete non-array type 'struct bar'}}20 expected-note@#bar {{forward declaration of 'struct bar'}}21 */22struct bar { int x; };23 24