Debian Codegraph @

clang/test/C/C2y/n3347.c

raw
1 // RUN: %clang_cc1 -verify -std=c2y -Wall -pedantic %s
2
3 /* WG14 N3347: Yes
4 * Slay Some Earthly Demons IX
5 *
6 * Declarations of a tentative definition with internal linkage must be
7 * complete by the end of the translation unit.
8 */
9
10 struct foo; // #foo
11 static 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
16 extern struct foo f2; // Ok, does not have internal linkage
17
18 struct bar; // #bar
19 static 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 */
22 struct bar { int x; };
23