================
@@ -1,45 +1,106 @@
-// RUN: %clang_cc1 -verify -std=c2y -Wall -pedantic -Wno-unused %s
+// RUN: %clang_cc1 -verify=c2y -std=c2y -Wall -pedantic -Wno-unused %s
+// RUN: %clang_cc1 -verify=c89-23 -std=c23 -Wall -pedantic -Wno-unused %s
+// RUN: %clang_cc1 -verify=c89-23 -std=c17 -Wall -pedantic -Wno-unused %s
+// RUN: %clang_cc1 -verify=c89-23 -std=c11 -Wall -pedantic -Wno-unused %s
+// RUN: %clang_cc1 -verify=c89-23 -std=c99 -Wall -pedantic -Wno-unused %s
+// RUN: %clang_cc1 -verify=c89-23 -std=c89 -Wall -pedantic -Wno-unused 
-Wno-comment %s
 
-/* WG14 N3410: No
+/* WG14 N3410: Clang 24
  * Slay Some Earthly Demons XI
  *
  * It is now ill-formed for the same identifier within a TU to have both
  * internal and external linkage.
  */
 
-void func1() {
-  extern int a; // #a
+void func1(void) {
+  extern int a; /* #a */
 }
 
-// This 'a' is the same as the one declared extern above.
-static int a; /* expected-error {{static declaration of 'a' follows non-static 
declaration}}
-                 expected-note@#a {{previous declaration is here}}
+/* This 'a' is the same as the one declared extern above. */
+static int a; /* c2y-error {{static declaration of 'a' follows non-static 
declaration}}
+                 c2y-note@#a {{previous declaration is here}}
+                 c89-23-error {{static declaration of 'a' follows non-static 
declaration; behavior is undefined}}
+                 c89-23-note@#a {{previous declaration is here}}
                */
 
 static int b;
-void func2() {
-  // This 'b' is the same as the one declaraed static above, but this is not
-  // ill-formed because of C2y 6.2.2p4, which gives this variable internal
-  // linkage because the previous declaration had internal linkage.
-  extern int b; // Ok
+void func2(void) {
+  /* This 'b' is the same as the one declared static above, but this is not
----------------
Endilll wrote:

```suggestion
  /* This 'b' is well-formed, because C2y 6.2.2p6 makes it "inherit" the static 
linkage of `static int b` above, because the latter is visible.
```
Note that I'm also fixing the wording reference from p4 to p6, because I think 
that is the load-bearing wording here, and not p4.
(reflow as you see fit)

https://github.com/llvm/llvm-project/pull/193567
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to