2017-12-05 Richard Biener <rguenther@suse.de>
[official-gcc.git] / gcc / testsuite / gcc.dg / local1.c
blobe9f653bcc56c2531d27ee26d45dcdca306e78752
1 /* This is allowed, with the effect that the 'extern' declaration at block
2 scope refers to the same object as the 'static' declaration at file scope.
4 C90 6.1.2.2 [as corrected by TC1], C99 6.2.2:
6 For an identifier declared with the storage-class specifier
7 extern in a scope in which a prior declaration of that
8 identifier is visible, if the prior declaration specifies
9 internal or external linkage, the linkage of the identifier at
10 the later daclaration is the same as the linkage specified at
11 the prior declaration. If no prior declaration is visible,
12 or if the prior declaration specifies no linkage, then the
13 identifer has external linkage.
15 This is PR 14366. */
17 static int i;
19 extern int i;
21 static void f() {
22 extern int i;