From 0b46121c4130eec702066bca65802c21a9517539 Mon Sep 17 00:00:00 2001
From: Aaron Ballman
Date: Thu, 2 Jun 2022 09:31:34 -0400
Subject: [PATCH] Update more DR status information for C.
This adds new files to track DRs 100-199 and 400-499, but the file
contents are still a work in progress. It also updates the associated
status in the DR tracking page.
---
clang/test/C/drs/dr0xx.c | 3 ++
clang/test/C/drs/dr1xx.c | 73 ++++++++++++++++++++++++++++++++++++++++++++++
clang/test/C/drs/dr4xx.c | 32 ++++++++++++++++++++
clang/www/c_dr_status.html | 33 ++++++++++++---------
4 files changed, 127 insertions(+), 14 deletions(-)
create mode 100644 clang/test/C/drs/dr1xx.c
create mode 100644 clang/test/C/drs/dr4xx.c
diff --git a/clang/test/C/drs/dr0xx.c b/clang/test/C/drs/dr0xx.c
index 5cc0823..522f36c 100644
--- a/clang/test/C/drs/dr0xx.c
+++ b/clang/test/C/drs/dr0xx.c
@@ -9,6 +9,9 @@
/* The following are DRs which do not require tests to demonstrate
* conformance or nonconformance.
*
+ * WG14 DR001: yes
+ * Do functions return values by copying?
+ *
* WG14 DR005: yes
* May a conforming implementation define and recognize a pragma which would
* change the semantics of the language?
diff --git a/clang/test/C/drs/dr1xx.c b/clang/test/C/drs/dr1xx.c
new file mode 100644
index 0000000..58c4386
--- /dev/null
+++ b/clang/test/C/drs/dr1xx.c
@@ -0,0 +1,73 @@
+/* RUN: %clang_cc1 -std=c89 -verify=expected,c89only -pedantic -Wno-c11-extensions %s
+ RUN: %clang_cc1 -std=c99 -verify=expected,c99untilc2x -pedantic -Wno-c11-extensions %s
+ RUN: %clang_cc1 -std=c11 -verify=expected,c99untilc2x -pedantic %s
+ RUN: %clang_cc1 -std=c17 -verify=expected,c99untilc2x -pedantic %s
+ RUN: %clang_cc1 -std=c2x -verify=expected,c2xandup -pedantic %s
+ */
+
+/* The following are DRs which do not require tests to demonstrate
+ * conformance or nonconformance.
+ *
+ * WG14 DR100: dup 001
+ * Defect with the return statement
+ *
+ * WG14 DR104: dup 084
+ * Incomplete tag types in a parameter list
+ */
+
+
+/* WG14 DR101: yes
+ * Type qualifiers and "as if by assignment"
+ */
+void dr101_callee(const int val);
+void dr101_caller(void) {
+ int val = 1;
+ dr101_callee(val); /* ok; const qualifier on the parameter doesn't prevent as-if assignment. */
+}
+
+/* WG14 DR102: yes
+ * Tag redeclaration constraints
+ */
+void dr102(void) {
+ struct S { int member; }; /* expected-note {{previous definition is here}} */
+ struct S { int member; }; /* expected-error {{redefinition of 'S'}} */
+
+ union U { int member; }; /* expected-note {{previous definition is here}} */
+ union U { int member; }; /* expected-error {{redefinition of 'U'}} */
+
+ enum E { member }; /* expected-note 2{{previous definition is here}} */
+ enum E { member }; /* expected-error {{redefinition of 'E'}}
+ expected-error {{redefinition of enumerator 'member'}} */
+}
+
+/* WG14 DR103: yes
+ * Formal parameters of incomplete type
+ */
+void dr103_1(int arg[]); /* ok, not an incomplete type due to rewrite */
+void dr103_2(struct S s) {} /* expected-warning {{declaration of 'struct S' will not be visible outside of this function}}
+ expected-error {{variable has incomplete type 'struct S'}}
+ expected-note {{forward declaration of 'struct S'}} */
+void dr103_3(struct S s); /* expected-warning {{declaration of 'struct S' will not be visible outside of this function}}
+ expected-note {{previous declaration is here}} */
+void dr103_3(struct S { int a; } s) { } /* expected-warning {{declaration of 'struct S' will not be visible outside of this function}}
+ expected-error {{conflicting types for 'dr103_3'}} */
+void dr103_4(struct S s1, struct S { int a; } s2); /* expected-warning {{declaration of 'struct S' will not be visible outside of this function}} */
+
+/* WG14 DR105: dup 017
+ * Precedence of requirements on compatible types
+ *
+ * NB: This is also Question 3 from DR017.
+ */
+void dr105(void) {
+ /* According to C2x 6.7.6.3p14 the return type and parameter types to be
+ * compatible types, but qualifiers are dropped from the parameter type.
+ */
+ extern void func(int);
+ extern void func(const int); /* FIXME: this should be pedantically diagnosed. */
+
+ extern void other_func(int); /* expected-note {{previous declaration is here}} */
+ extern void other_func(int *); /* expected-error {{conflicting types for 'other_func'}} */
+
+ extern int i; /* expected-note {{previous declaration is here}} */
+ extern float i; /* expected-error {{redeclaration of 'i' with a different type: 'float' vs 'int'}} */
+}
diff --git a/clang/test/C/drs/dr4xx.c b/clang/test/C/drs/dr4xx.c
new file mode 100644
index 0000000..ab34075
--- /dev/null
+++ b/clang/test/C/drs/dr4xx.c
@@ -0,0 +1,32 @@
+/* RUN: %clang_cc1 -std=c89 -verify=expected,c89only -pedantic -Wno-c11-extensions %s
+ RUN: %clang_cc1 -std=c99 -verify=expected,c99untilc2x -pedantic -Wno-c11-extensions %s
+ RUN: %clang_cc1 -std=c11 -verify=expected,c99untilc2x -pedantic %s
+ RUN: %clang_cc1 -std=c17 -verify=expected,c99untilc2x -pedantic %s
+ RUN: %clang_cc1 -std=c2x -verify=expected,c2xandup -pedantic %s
+ */
+
+/* The following are DRs which do not require tests to demonstrate
+ * conformance or nonconformance.
+ */
+
+
+/* WG14 DR423: partial
+ * Defect Report relative to n1570: underspecification for qualified rvalues
+ */
+
+/* FIXME: this should pass because the qualifier on the return type should be
+ * dropped when forming the function type.
+ */
+const int dr423_const(void);
+int dr423_nonconst(void);
+_Static_assert(__builtin_types_compatible_p(__typeof__(dr423_const), __typeof__(dr423_nonconst)), "fail"); /* expected-error {{fail}} */
+
+void dr423_func(void) {
+ const int i = 12;
+ __typeof__(i) v1 = 12; /* expected-note {{variable 'v1' declared const here}} */
+ __typeof__((const int)12) v2 = 12;
+
+ v1 = 100; /* expected-error {{cannot assign to variable 'v1' with const-qualified type 'typeof (i)' (aka 'const int')}} */
+ v2 = 100; /* Not an error; the qualifier was stripped. */
+}
+
diff --git a/clang/www/c_dr_status.html b/clang/www/c_dr_status.html
index d0ae947..aa2b21d 100644
--- a/clang/www/c_dr_status.html
+++ b/clang/www/c_dr_status.html
@@ -52,7 +52,7 @@ conformance.
1 |
C89 |
Do functions return values by copying? |
- Unknown |
+ Yes |
2 |
@@ -654,38 +654,38 @@ conformance.
100 |
Dup |
- ANSI/ISO C Defect report #rfg7 |
- Duplicate of 1 |
+ Defect with the return statement |
+ Duplicate of 1 |
101 |
C89 |
- ANSI/ISO C Defect report #rfg8 |
- Unknown |
+ Type qualifiers and "as if by assignment" |
+ Yes |
102 |
NAD |
- ANSI/ISO C Defect report #rfg9 |
- Unknown |
+ Tag redeclaration constraints |
+ Yes |
103 |
NAD |
- ANSI/ISO C Defect report #rfg10 |
- Unknown |
+ Formal parameters of incomplete type |
+ Yes |
104 |
Dup |
- ANSI/ISO C Defect report #rfg11 |
- Duplicate of 84 |
+ Incomplete tag types in a parameter list |
+ Duplicate of 84 |
105 |
Dup |
- ANSI/ISO C Defect report #rfg12 |
- Duplicate of 17 |
+ Precedence of requirements on compatible types |
+ Duplicate of 17 |
106 |
@@ -2137,7 +2137,12 @@ conformance.
423 |
C11 |
Defect Report relative to n1570: underspecification for qualified rvalues |
- Clang 15 |
+
+ Partial
+ Clang properly handles dropping qualifiers from cast operations, but
+ does not yet handle dropping qualifiers from the function return type.
+
+ |
424 |
--
2.7.4