Skip to content

Commit f3effc2

Browse files
committed
[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.
1 parent 5f6b058 commit f3effc2

File tree

2 files changed

+24
-1
lines changed

2 files changed

+24
-1
lines changed

clang/test/C/C2y/n3347.c

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
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+

clang/www/c_status.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -258,7 +258,7 @@ <h2 id="c2y">C2y implementation status</h2>
258258
<tr>
259259
<td>Slay Some Earthly Demons IX</td>
260260
<td><a href="https://www.open-std.org/jtc1/sc22/wg14/www/docs/n3347.pdf">N3347</a></td>
261-
<td class="unknown" align="center">Unknown</td>
261+
<td class="full" align="center">Yes</td>
262262
</tr>
263263
<tr>
264264
<td>stdarg.h wording... v3</td>

0 commit comments

Comments
 (0)