[clang] f3effc2 - [C2y] Claim conformance to N3347

Aaron Ballman via cfe-commits cfe-commits at lists.llvm.org
Thu Mar 6 13:21:51 PST 2025


Author: Aaron Ballman
Date: 2025-03-06T16:21:40-05:00
New Revision: f3effc24004a99c6167680a66b1f95bde3c268f4

URL: https://github.com/llvm/llvm-project/commit/f3effc24004a99c6167680a66b1f95bde3c268f4
DIFF: https://github.com/llvm/llvm-project/commit/f3effc24004a99c6167680a66b1f95bde3c268f4.diff

LOG: [C2y] Claim conformance to N3347

This paper made it a constraint violation to have a tentative
definition with internal linkage which is not completed by the end of
the translation unit.

This has been diagnosed as an error since at least Clang 3.0, so no
changes are needed.

Added: 
    clang/test/C/C2y/n3347.c

Modified: 
    clang/www/c_status.html

Removed: 
    


################################################################################
diff  --git a/clang/test/C/C2y/n3347.c b/clang/test/C/C2y/n3347.c
new file mode 100644
index 0000000000000..ed816f3941725
--- /dev/null
+++ b/clang/test/C/C2y/n3347.c
@@ -0,0 +1,23 @@
+// RUN: %clang_cc1 -verify -std=c2y -Wall -pedantic %s
+
+/* WG14 N3347: Yes
+ * Slay Some Earthly Demons IX
+ *
+ * Declarations of a tentative definition with internal linkage must be
+ * complete by the end of the translation unit.
+ */
+
+struct foo; // #foo
+static struct foo f1; /* expected-warning {{tentative definition of variable with internal linkage has incomplete non-array type 'struct foo'}}
+                         expected-error {{tentative definition has type 'struct foo' that is never completed}}
+                         expected-note@#foo 2 {{forward declaration of 'struct foo'}}
+                       */
+
+extern struct foo f2; // Ok, does not have internal linkage
+
+struct bar; // #bar
+static struct bar b; /* expected-warning {{tentative definition of variable with internal linkage has incomplete non-array type 'struct bar'}}
+                        expected-note@#bar {{forward declaration of 'struct bar'}}
+                      */
+struct bar { int x; };
+

diff  --git a/clang/www/c_status.html b/clang/www/c_status.html
index 41643f6d13913..4e912987b69c6 100644
--- a/clang/www/c_status.html
+++ b/clang/www/c_status.html
@@ -258,7 +258,7 @@ <h2 id="c2y">C2y implementation status</h2>
     <tr>
       <td>Slay Some Earthly Demons IX</td>
       <td><a href="https://www.open-std.org/jtc1/sc22/wg14/www/docs/n3347.pdf">N3347</a></td>
-      <td class="unknown" align="center">Unknown</td>
+      <td class="full" align="center">Yes</td>
 	</tr>
     <tr>
       <td>stdarg.h wording... v3</td>


        


More information about the cfe-commits mailing list