File tree Expand file tree Collapse file tree 2 files changed +46
-1
lines changed Expand file tree Collapse file tree 2 files changed +46
-1
lines changed Original file line number Diff line number Diff line change
1
+ // RUN: %clang_cc1 -verify -std=c2y -Wall -pedantic -Wno-unused %s
2
+
3
+ /* WG14 N3410: No
4
+ * Slay Some Earthly Demons XI
5
+ *
6
+ * It is now ill-formed for the same identifier within a TU to have both
7
+ * internal and external linkage.
8
+ */
9
+
10
+ void func1 () {
11
+ extern int a ; // #a
12
+ }
13
+
14
+ // This 'a' is the same as the one declared extern above.
15
+ static int a ; /* expected-error {{static declaration of 'a' follows non-static declaration}}
16
+ expected-note@#a {{previous declaration is here}}
17
+ */
18
+
19
+ static int b ;
20
+ void func2 () {
21
+ // This 'b' is the same as the one declaraed static above, but this is not
22
+ // ill-formed because of C2y 6.2.2p4, which gives this variable internal
23
+ // linkage because the previous declaration had internal linkage.
24
+ extern int b ; // Ok
25
+ }
26
+
27
+ static int c , d ;
28
+ void func3 () {
29
+ int c ; // no linkage, different object from the one declared above.
30
+ for (int d ;;) {
31
+ // This 'c' is the same as the one declared at file scope, but because of
32
+ // the local scope 'c', the file scope 'c' is not visible.
33
+ // FIXME: This should be diagnosed under N3410.
34
+ extern int c ;
35
+ // This 'd' is the same as the one declared at file scope as well, but
36
+ // because of the 'd' declared within the for loop, the file scope 'd' is
37
+ // also not visible, same as with 'c'.
38
+ // FIXME: This should be diagnosed under N3410.
39
+ extern int d ;
40
+ }
41
+ for (static int e ;;) {
42
+ extern int e ; // Ok for the same reason as 'b' above.
43
+ }
44
+ }
45
+
Original file line number Diff line number Diff line change @@ -289,7 +289,7 @@ <h2 id="c2y">C2y implementation status</h2>
289
289
< tr >
290
290
< td > Slay Some Earthly Demons XI</ td >
291
291
< td > < a href ="https://www.open-std.org/jtc1/sc22/wg14/www/docs/n3410.pdf "> N3410</ a > </ td >
292
- < td class ="unknown " align ="center "> Unknown </ td >
292
+ < td class ="none " align ="center "> No </ td >
293
293
</ tr >
294
294
< tr >
295
295
< td > Slay Some Earthly Demons XII</ td >
You can’t perform that action at this time.
0 commit comments