[clang] Add tests for CWG issues 6, 212, 232, 2823. (PR #165633)
Richard Smith via cfe-commits
cfe-commits at lists.llvm.org
Thu Oct 30 14:35:46 PDT 2025
https://github.com/zygoloid updated https://github.com/llvm/llvm-project/pull/165633
>From e1017d06119c0cb5a0fa82a39bf74ed698c8366a Mon Sep 17 00:00:00 2001
From: Richard Smith <richard at metafoo.co.uk>
Date: Thu, 30 Oct 2025 00:35:18 +0000
Subject: [PATCH 1/5] Add tests for CWG issues 6, 212, 232, 2823.
Unfortunately this adds two more "no"s to cxx_dr_status.
---
clang/test/CXX/drs/cwg0xx.cpp | 18 +++
clang/test/CXX/drs/cwg28xx.cpp | 16 ++
clang/test/CXX/drs/cwg2xx.cpp | 34 +++++
clang/test/CXX/drs/cwg6.cpp | 31 ++++
clang/www/cxx_dr_status.html | 268 +++++++++++++++++++++++++++++----
5 files changed, 335 insertions(+), 32 deletions(-)
create mode 100644 clang/test/CXX/drs/cwg6.cpp
diff --git a/clang/test/CXX/drs/cwg0xx.cpp b/clang/test/CXX/drs/cwg0xx.cpp
index 805be67f2dc1a..1d488b986ad73 100644
--- a/clang/test/CXX/drs/cwg0xx.cpp
+++ b/clang/test/CXX/drs/cwg0xx.cpp
@@ -90,6 +90,24 @@ namespace cwg5 { // cwg5: 3.1
const C c = e;
} // namespace cwg5
+namespace cwg6 { // cwg6 codegen is tested in cwg6.cpp
+#if __cplusplus >= 201103L
+ struct Counter {
+ int copies;
+ constexpr Counter(int copies) : copies(copies) {}
+ constexpr Counter(const Counter& other) : copies(other.copies + 1) {}
+ };
+
+ // Passing an lvalue by value makes a non-elidable copy.
+ constexpr int PassByValue(Counter c) { return c.copies; }
+ constexpr int PassByValue2(Counter c) { return PassByValue(c); }
+ constexpr int PassByValue3(Counter c) { return PassByValue2(c); }
+ static_assert(PassByValue(Counter(0)) == 0, "expect no copies");
+ static_assert(PassByValue2(Counter(0)) == 1, "expect 1 copy");
+ static_assert(PassByValue3(Counter(0)) == 2, "expect 2 copies");
+#endif
+} // namespace cwg6
+
namespace cwg7 { // cwg7: 3.4
class A { public: ~A(); };
class B : virtual private A {}; // #cwg7-B
diff --git a/clang/test/CXX/drs/cwg28xx.cpp b/clang/test/CXX/drs/cwg28xx.cpp
index a6b2b99e0c3f1..8aa6f629f5311 100644
--- a/clang/test/CXX/drs/cwg28xx.cpp
+++ b/clang/test/CXX/drs/cwg28xx.cpp
@@ -61,6 +61,22 @@ namespace cwg2819 { // cwg2819: 19 c++26
#endif
} // namespace cwg2819
+namespace cwg2823 { // cwg2823: no
+#if __cplusplus >= 201103L
+ constexpr int *p = 0;
+ constexpr int *q1 = &*p; // expected-error {{constant expression}} expected-note {{dereferencing a null pointer}}
+ // FIXME: invalid: dereferencing a null pointer.
+ constexpr int *q2 = &p[0];
+
+ int arr[32];
+ constexpr int *r = arr;
+ // FIXME: invalid: dereferencing a past-the-end pointer.
+ constexpr int *s1 = &*(r + 32);
+ // FIXME: invalid: dereferencing a past-the-end pointer.
+ constexpr int *s2 = &r[32];
+#endif
+}
+
namespace cwg2847 { // cwg2847: 19 review 2024-03-01
#if __cplusplus >= 202002L
diff --git a/clang/test/CXX/drs/cwg2xx.cpp b/clang/test/CXX/drs/cwg2xx.cpp
index 37186e3c3f205..2321854b22c4b 100644
--- a/clang/test/CXX/drs/cwg2xx.cpp
+++ b/clang/test/CXX/drs/cwg2xx.cpp
@@ -230,6 +230,37 @@ namespace cwg211 { // cwg211: 2.7
};
} // namespace cwg211
+namespace cwg212 { // cwg212: yes
+ template<typename T> struct Base;
+ template<typename T> struct Derived;
+
+ int *overload(void*);
+ float *overload(Base<int>*);
+ double *overload(Base<long>*);
+
+ void f(Derived<int> *p) {
+ // OK, calls void* overload.
+ int *a = overload(p);
+
+ Base<int> *q = p; // expected-error {{cannot initialize}}
+ }
+
+ template<typename T> struct Base {};
+ template<typename T> struct Derived : Base<T> {};
+
+ void g(Derived<long> *p) {
+ // OK, instantiates and calls Base<long>* overlod.
+ double *b = overload(p);
+ (void)b;
+ }
+
+ void h(Derived<float> *p) {
+ // OK, instantiates and converts.
+ Base<float> *q = p;
+ (void)q;
+ }
+}
+
namespace cwg213 { // cwg213: 2.7
template <class T> struct A : T {
void h(T t) {
@@ -593,6 +624,9 @@ namespace cwg231 { // cwg231: 2.7
}
} // namespace cwg231
+// 232 is NAD; the desired behavior is described in 2823.
+// cwg232: dup 2823
+
// cwg234: na
// cwg235: na
diff --git a/clang/test/CXX/drs/cwg6.cpp b/clang/test/CXX/drs/cwg6.cpp
new file mode 100644
index 0000000000000..888af2acad35a
--- /dev/null
+++ b/clang/test/CXX/drs/cwg6.cpp
@@ -0,0 +1,31 @@
+// RUN: %clang_cc1 -std=c++98 %s -triple x86_64-linux-gnu -emit-llvm -o - -fexceptions -fcxx-exceptions -pedantic-errors | FileCheck %s --check-prefixes CHECK
+// RUN: %clang_cc1 -std=c++11 %s -triple x86_64-linux-gnu -emit-llvm -o - -fexceptions -fcxx-exceptions -pedantic-errors | FileCheck %s --check-prefixes CHECK
+// RUN: %clang_cc1 -std=c++14 %s -triple x86_64-linux-gnu -emit-llvm -o - -fexceptions -fcxx-exceptions -pedantic-errors | FileCheck %s --check-prefixes CHECK
+// RUN: %clang_cc1 -std=c++17 %s -triple x86_64-linux-gnu -emit-llvm -o - -fexceptions -fcxx-exceptions -pedantic-errors | FileCheck %s --check-prefixes CHECK
+// RUN: %clang_cc1 -std=c++20 %s -triple x86_64-linux-gnu -emit-llvm -o - -fexceptions -fcxx-exceptions -pedantic-errors | FileCheck %s --check-prefixes CHECK
+// RUN: %clang_cc1 -std=c++23 %s -triple x86_64-linux-gnu -emit-llvm -o - -fexceptions -fcxx-exceptions -pedantic-errors | FileCheck %s --check-prefixes CHECK
+// RUN: %clang_cc1 -std=c++2c %s -triple x86_64-linux-gnu -emit-llvm -o - -fexceptions -fcxx-exceptions -pedantic-errors | FileCheck %s --check-prefixes CHECK
+
+namespace cwg6 { // cwg6: yes
+
+struct A {
+ A();
+ A(const A&);
+ ~A();
+};
+
+inline void f(A a) {}
+
+// CHECK-LABEL: define {{.*}} @_ZN4cwg64callEv
+void call() {
+ A a;
+ // We copy the parameter here, even though object is not mutated by f and
+ // otherwise satisfies the criteria for the proposed CWG6 optimization.
+ // CHECK: {{call|invoke}} {{.*}} @_ZN4cwg61AC1ERKS0_
+ // CHECK: {{call|invoke}} {{.*}} @_ZN4cwg61fE
+ f(a);
+ // CHECK: {{call|invoke}} {{.*}} @_ZN4cwg61AD1Ev
+ // CHECK: {{call|invoke}} {{.*}} @_ZN4cwg61AD1Ev
+}
+
+} // namespace cwg6
diff --git a/clang/www/cxx_dr_status.html b/clang/www/cxx_dr_status.html
index b7da22cf9fb22..0312c9dfc0665 100755
--- a/clang/www/cxx_dr_status.html
+++ b/clang/www/cxx_dr_status.html
@@ -81,7 +81,7 @@ <h2 id="cxxdr">C++ defect report implementation status</h2>
<td><a href="https://cplusplus.github.io/CWG/issues/6.html">6</a></td>
<td>NAD</td>
<td>Should the optimization that allows a class object to alias another object also allow the case of a parameter in an inline function to alias its argument?</td>
- <td class="unknown" align="center">Unknown</td>
+ <td class="full" align="center">Yes</td>
</tr>
<tr id="7">
<td><a href="https://cplusplus.github.io/CWG/issues/7.html">7</a></td>
@@ -1318,7 +1318,7 @@ <h2 id="cxxdr">C++ defect report implementation status</h2>
<td><a href="https://cplusplus.github.io/CWG/issues/212.html">212</a></td>
<td>CD4</td>
<td>Implicit instantiation is not described clearly enough</td>
- <td class="unknown" align="center">Unknown</td>
+ <td class="full" align="center">Yes</td>
</tr>
<tr id="213">
<td><a href="https://cplusplus.github.io/CWG/issues/213.html">213</a></td>
@@ -1438,7 +1438,7 @@ <h2 id="cxxdr">C++ defect report implementation status</h2>
<td><a href="https://cplusplus.github.io/CWG/issues/232.html">232</a></td>
<td>NAD</td>
<td>Is indirection through a null pointer undefined behavior?</td>
- <td class="unknown" align="center">Unknown</td>
+ <td class="none" align="center">Duplicate of <a href="#2823">2823</a></td>
</tr>
<tr id="233">
<td><a href="https://cplusplus.github.io/CWG/issues/233.html">233</a></td>
@@ -3113,11 +3113,11 @@ <h2 id="cxxdr">C++ defect report implementation status</h2>
<td>Default initialization of POD classes?</td>
<td class="na" align="center">N/A</td>
</tr>
- <tr class="open" id="511">
+ <tr id="511">
<td><a href="https://cplusplus.github.io/CWG/issues/511.html">511</a></td>
- <td>open</td>
+ <td>NAD</td>
<td>POD-structs with template assignment operators</td>
- <td align="center">Not resolved</td>
+ <td class="unknown" align="center">Unknown</td>
</tr>
<tr id="512">
<td><a href="https://cplusplus.github.io/CWG/issues/512.html">512</a></td>
@@ -10895,7 +10895,7 @@ <h2 id="cxxdr">C++ defect report implementation status</h2>
</tr>
<tr class="open" id="1845">
<td><a href="https://cplusplus.github.io/CWG/issues/1845.html">1845</a></td>
- <td>drafting</td>
+ <td>review</td>
<td>Point of instantiation of a variable template specialization</td>
<td align="center">Not resolved</td>
</tr>
@@ -12081,7 +12081,7 @@ <h2 id="cxxdr">C++ defect report implementation status</h2>
</tr>
<tr class="open" id="2042">
<td><a href="https://cplusplus.github.io/CWG/issues/2042.html">2042</a></td>
- <td>drafting</td>
+ <td>review</td>
<td>Exceptions and deallocation functions</td>
<td align="center">Not resolved</td>
</tr>
@@ -12335,7 +12335,7 @@ <h2 id="cxxdr">C++ defect report implementation status</h2>
<td><a href="https://cplusplus.github.io/CWG/issues/2084.html">2084</a></td>
<td>CD4</td>
<td>NSDMIs and deleted union default constructors</td>
- <td class="unknown" align="center">Unknown</td>
+ <td class="full" align="center">Clang 3.1</td>
</tr>
<tr id="2085">
<td><a href="https://cplusplus.github.io/CWG/issues/2085.html">2085</a></td>
@@ -12837,7 +12837,7 @@ <h2 id="cxxdr">C++ defect report implementation status</h2>
</tr>
<tr class="open" id="2168">
<td><a href="https://cplusplus.github.io/CWG/issues/2168.html">2168</a></td>
- <td>open</td>
+ <td>review</td>
<td>Narrowing conversions and +/- infinity</td>
<td align="center">Not resolved</td>
</tr>
@@ -14237,11 +14237,11 @@ <h2 id="cxxdr">C++ defect report implementation status</h2>
<td>Constexpr virtual functions and temporary objects</td>
<td class="unknown" align="center">Unknown</td>
</tr>
- <tr class="open" id="2401">
+ <tr id="2401">
<td><a href="https://cplusplus.github.io/CWG/issues/2401.html">2401</a></td>
- <td>drafting</td>
+ <td>C++20</td>
<td>Array decay vs prohibition of subobject non-type arguments</td>
- <td align="center">Not resolved</td>
+ <td class="unknown" align="center">Unknown</td>
</tr>
<tr id="2402">
<td><a href="https://cplusplus.github.io/CWG/issues/2402.html">2402</a></td>
@@ -15171,7 +15171,7 @@ <h2 id="cxxdr">C++ defect report implementation status</h2>
</tr>
<tr class="open" id="2555">
<td><a href="https://cplusplus.github.io/CWG/issues/2555.html">2555</a></td>
- <td>drafting</td>
+ <td>tentatively ready</td>
<td>Ineffective redeclaration prevention for <I>using-declarator</I>s</td>
<td align="center">Not resolved</td>
</tr>
@@ -15311,23 +15311,23 @@ <h2 id="cxxdr">C++ defect report implementation status</h2>
<td>Undefined behavior for preprocessing directives in macro arguments</td>
<td align="center">Not resolved</td>
</tr>
- <tr class="open" id="2578">
+ <tr id="2578">
<td><a href="https://cplusplus.github.io/CWG/issues/2578.html">2578</a></td>
- <td>open</td>
+ <td>CD7</td>
<td>Undefined behavior when creating an invalid string literal via stringizing</td>
- <td align="center">Not resolved</td>
+ <td class="unknown" align="center">Unknown</td>
</tr>
- <tr class="open" id="2579">
+ <tr id="2579">
<td><a href="https://cplusplus.github.io/CWG/issues/2579.html">2579</a></td>
- <td>open</td>
+ <td>CD7</td>
<td>Undefined behavior when token pasting does not create a preprocessing token</td>
- <td align="center">Not resolved</td>
+ <td class="unknown" align="center">Unknown</td>
</tr>
- <tr class="open" id="2580">
+ <tr id="2580">
<td><a href="https://cplusplus.github.io/CWG/issues/2580.html">2580</a></td>
- <td>open</td>
+ <td>CD7</td>
<td>Undefined behavior with <TT>#line</TT></td>
- <td align="center">Not resolved</td>
+ <td class="unknown" align="center">Unknown</td>
</tr>
<tr class="open" id="2581">
<td><a href="https://cplusplus.github.io/CWG/issues/2581.html">2581</a></td>
@@ -16790,7 +16790,7 @@ <h2 id="cxxdr">C++ defect report implementation status</h2>
<td><a href="https://cplusplus.github.io/CWG/issues/2823.html">2823</a></td>
<td>CD7</td>
<td>Implicit undefined behavior when dereferencing pointers</td>
- <td class="unknown" align="center">Unknown</td>
+ <td class="none" align="center">No</td>
</tr>
<tr id="2824">
<td><a href="https://cplusplus.github.io/CWG/issues/2824.html">2824</a></td>
@@ -17104,7 +17104,7 @@ <h2 id="cxxdr">C++ defect report implementation status</h2>
</tr>
<tr class="open" id="2875">
<td><a href="https://cplusplus.github.io/CWG/issues/2875.html">2875</a></td>
- <td>review</td>
+ <td>tentatively ready</td>
<td>Missing support for round-tripping null pointer values through indirection/address operators</td>
<td align="center">Not resolved</td>
</tr>
@@ -17400,7 +17400,7 @@ <h2 id="cxxdr">C++ defect report implementation status</h2>
</tr>
<tr class="open" id="2923">
<td><a href="https://cplusplus.github.io/CWG/issues/2923.html">2923</a></td>
- <td>review</td>
+ <td>tentatively ready</td>
<td>Note about infinite loops and execution steps</td>
<td align="center">Not resolved</td>
</tr>
@@ -17760,7 +17760,7 @@ <h2 id="cxxdr">C++ defect report implementation status</h2>
</tr>
<tr class="open" id="2983">
<td><a href="https://cplusplus.github.io/CWG/issues/2983.html">2983</a></td>
- <td>open</td>
+ <td>review</td>
<td>Non-type template parameters are not variables</td>
<td align="center">Not resolved</td>
</tr>
@@ -17868,7 +17868,7 @@ <h2 id="cxxdr">C++ defect report implementation status</h2>
</tr>
<tr class="open" id="3001">
<td><a href="https://cplusplus.github.io/CWG/issues/3001.html">3001</a></td>
- <td>review</td>
+ <td>tentatively ready</td>
<td>Inconsistent restrictions for <TT>static_cast</TT> on pointers to out-of-lifetime objects</td>
<td align="center">Not resolved</td>
</tr>
@@ -17932,7 +17932,7 @@ <h2 id="cxxdr">C++ defect report implementation status</h2>
</tr>
<tr class="open" id="3011">
<td><a href="https://cplusplus.github.io/CWG/issues/3011.html">3011</a></td>
- <td>open</td>
+ <td>tentatively ready</td>
<td>Parenthesized aggregate initialization for <I>new-expression</I>s</td>
<td align="center">Not resolved</td>
</tr>
@@ -17992,7 +17992,7 @@ <h2 id="cxxdr">C++ defect report implementation status</h2>
</tr>
<tr class="open" id="3021">
<td><a href="https://cplusplus.github.io/CWG/issues/3021.html">3021</a></td>
- <td>open</td>
+ <td>drafting</td>
<td>Subsumption rules for fold expanded constraints</td>
<td align="center">Not resolved</td>
</tr>
@@ -18058,7 +18058,7 @@ <h2 id="cxxdr">C++ defect report implementation status</h2>
</tr>
<tr class="open" id="3032">
<td><a href="https://cplusplus.github.io/CWG/issues/3032.html">3032</a></td>
- <td>open</td>
+ <td>tentatively ready</td>
<td>Template argument disambiguation</td>
<td align="center">Not resolved</td>
</tr>
@@ -18184,7 +18184,7 @@ <h2 id="cxxdr">C++ defect report implementation status</h2>
</tr>
<tr class="open" id="3053">
<td><a href="https://cplusplus.github.io/CWG/issues/3053.html">3053</a></td>
- <td>open</td>
+ <td>tentatively ready</td>
<td>Allowing <TT>#undef likely</TT></td>
<td align="center">Not resolved</td>
</tr>
@@ -18265,6 +18265,210 @@ <h2 id="cxxdr">C++ defect report implementation status</h2>
<td>tentatively ready</td>
<td>Declarative <I>nested-name-specifier</I> in explicit instantiation</td>
<td align="center">Not resolved</td>
+ </tr>
+ <tr class="open" id="3067">
+ <td><a href="https://cplusplus.github.io/CWG/issues/3067.html">3067</a></td>
+ <td>open</td>
+ <td>Array-to-pointer conversion with object type mismatch</td>
+ <td align="center">Not resolved</td>
+ </tr>
+ <tr class="open" id="3068">
+ <td><a href="https://cplusplus.github.io/CWG/issues/3068.html">3068</a></td>
+ <td>open</td>
+ <td>Access checking in friends involving <I>qualified-id</I>s</td>
+ <td align="center">Not resolved</td>
+ </tr>
+ <tr class="open" id="3069">
+ <td><a href="https://cplusplus.github.io/CWG/issues/3069.html">3069</a></td>
+ <td>open</td>
+ <td>Reference to wrong placeholder</td>
+ <td align="center">Not resolved</td>
+ </tr>
+ <tr class="open" id="3070">
+ <td><a href="https://cplusplus.github.io/CWG/issues/3070.html">3070</a></td>
+ <td>open</td>
+ <td>Trivial assignment can skip member subobjects</td>
+ <td align="center">Not resolved</td>
+ </tr>
+ <tr class="open" id="3071">
+ <td><a href="https://cplusplus.github.io/CWG/issues/3071.html">3071</a></td>
+ <td>open</td>
+ <td>Negative <TT>tuple_size</TT> in structured bindings</td>
+ <td align="center">Not resolved</td>
+ </tr>
+ <tr class="open" id="3072">
+ <td><a href="https://cplusplus.github.io/CWG/issues/3072.html">3072</a></td>
+ <td>open</td>
+ <td>Incorrect examples for lambda SFINAE</td>
+ <td align="center">Not resolved</td>
+ </tr>
+ <tr class="open" id="3073">
+ <td><a href="https://cplusplus.github.io/CWG/issues/3073.html">3073</a></td>
+ <td>open</td>
+ <td>Dependence of <I>R</I> on <TT>T2</TT> is unclear</td>
+ <td align="center">Not resolved</td>
+ </tr>
+ <tr class="open" id="3074">
+ <td><a href="https://cplusplus.github.io/CWG/issues/3074.html">3074</a></td>
+ <td>tentatively ready</td>
+ <td>Redundant ill-formedness for module macros</td>
+ <td align="center">Not resolved</td>
+ </tr>
+ <tr class="open" id="3075">
+ <td><a href="https://cplusplus.github.io/CWG/issues/3075.html">3075</a></td>
+ <td>tentatively ready</td>
+ <td>Unclear matching of import directive</td>
+ <td align="center">Not resolved</td>
+ </tr>
+ <tr class="open" id="3076">
+ <td><a href="https://cplusplus.github.io/CWG/issues/3076.html">3076</a></td>
+ <td>tentatively ready</td>
+ <td>Remove unnecessary IFNDR for malformed <I>header-name-token</I>s</td>
+ <td align="center">Not resolved</td>
+ </tr>
+ <tr class="open" id="3077">
+ <td><a href="https://cplusplus.github.io/CWG/issues/3077.html">3077</a></td>
+ <td>tentatively ready</td>
+ <td>Undesirable formation of <TT>import</TT> directive with <I>string-literal</I></td>
+ <td align="center">Not resolved</td>
+ </tr>
+ <tr class="open" id="3078">
+ <td><a href="https://cplusplus.github.io/CWG/issues/3078.html">3078</a></td>
+ <td>review</td>
+ <td>Different treatment of <TT>#include</TT> <I>pp-tokens</I> and <I>header-name-tokens</I></td>
+ <td align="center">Not resolved</td>
+ </tr>
+ <tr class="open" id="3079">
+ <td><a href="https://cplusplus.github.io/CWG/issues/3079.html">3079</a></td>
+ <td>open</td>
+ <td>Allow <I>empty-declaration</I>s in anonymous unions</td>
+ <td align="center">Not resolved</td>
+ </tr>
+ <tr class="open" id="3080">
+ <td><a href="https://cplusplus.github.io/CWG/issues/3080.html">3080</a></td>
+ <td>tentatively ready</td>
+ <td>Clarify kinds of permitted template template arguments</td>
+ <td align="center">Not resolved</td>
+ </tr>
+ <tr class="open" id="3081">
+ <td><a href="https://cplusplus.github.io/CWG/issues/3081.html">3081</a></td>
+ <td>review</td>
+ <td>Require glvalue when splicing direct base class relationship</td>
+ <td align="center">Not resolved</td>
+ </tr>
+ <tr class="open" id="3082">
+ <td><a href="https://cplusplus.github.io/CWG/issues/3082.html">3082</a></td>
+ <td>tentatively ready</td>
+ <td>Allow for call-compatible function types in <TT>reinterpret_cast</TT></td>
+ <td align="center">Not resolved</td>
+ </tr>
+ <tr class="open" id="3083">
+ <td><a href="https://cplusplus.github.io/CWG/issues/3083.html">3083</a></td>
+ <td>tentatively ready</td>
+ <td>Remove redundant restrictions on class and enum definitions</td>
+ <td align="center">Not resolved</td>
+ </tr>
+ <tr class="open" id="3084">
+ <td><a href="https://cplusplus.github.io/CWG/issues/3084.html">3084</a></td>
+ <td>tentatively ready</td>
+ <td><I>compound-statement</I>s inside <I>iteration-statement</I>s</td>
+ <td align="center">Not resolved</td>
+ </tr>
+ <tr class="open" id="3085">
+ <td><a href="https://cplusplus.github.io/CWG/issues/3085.html">3085</a></td>
+ <td>tentatively ready</td>
+ <td>Apply restriction inside for-range-declaration</td>
+ <td align="center">Not resolved</td>
+ </tr>
+ <tr class="open" id="3086">
+ <td><a href="https://cplusplus.github.io/CWG/issues/3086.html">3086</a></td>
+ <td>tentatively ready</td>
+ <td>Destringizing should consider all sorts of encoding-prefixes</td>
+ <td align="center">Not resolved</td>
+ </tr>
+ <tr class="open" id="3087">
+ <td><a href="https://cplusplus.github.io/CWG/issues/3087.html">3087</a></td>
+ <td>open</td>
+ <td>Destringizing for raw string literals</td>
+ <td align="center">Not resolved</td>
+ </tr>
+ <tr class="open" id="3088">
+ <td><a href="https://cplusplus.github.io/CWG/issues/3088.html">3088</a></td>
+ <td>open</td>
+ <td>Clarify macro treatment of identifiers with special meaning</td>
+ <td align="center">Not resolved</td>
+ </tr>
+ <tr class="open" id="3089">
+ <td><a href="https://cplusplus.github.io/CWG/issues/3089.html">3089</a></td>
+ <td>tentatively ready</td>
+ <td>const-default-constructible improperly handles std::meta::info</td>
+ <td align="center">Not resolved</td>
+ </tr>
+ <tr class="open" id="3090">
+ <td><a href="https://cplusplus.github.io/CWG/issues/3090.html">3090</a></td>
+ <td>tentatively ready</td>
+ <td>Internal linkage from header units</td>
+ <td align="center">Not resolved</td>
+ </tr>
+ <tr class="open" id="3091">
+ <td><a href="https://cplusplus.github.io/CWG/issues/3091.html">3091</a></td>
+ <td>review</td>
+ <td>Linking of translation units as sequences of tokens</td>
+ <td align="center">Not resolved</td>
+ </tr>
+ <tr class="open" id="3092">
+ <td><a href="https://cplusplus.github.io/CWG/issues/3092.html">3092</a></td>
+ <td>tentatively ready</td>
+ <td><I>base-specifier</I>s are not "declared"</td>
+ <td align="center">Not resolved</td>
+ </tr>
+ <tr class="open" id="3093">
+ <td><a href="https://cplusplus.github.io/CWG/issues/3093.html">3093</a></td>
+ <td>open</td>
+ <td>Missing integration of direct base class relationships</td>
+ <td align="center">Not resolved</td>
+ </tr>
+ <tr class="open" id="3094">
+ <td><a href="https://cplusplus.github.io/CWG/issues/3094.html">3094</a></td>
+ <td>review</td>
+ <td>Rework phases for string literal concatenation and token formation</td>
+ <td align="center">Not resolved</td>
+ </tr>
+ <tr class="open" id="3095">
+ <td><a href="https://cplusplus.github.io/CWG/issues/3095.html">3095</a></td>
+ <td>open</td>
+ <td>Type-dependent packs that are not structured binding packs</td>
+ <td align="center">Not resolved</td>
+ </tr>
+ <tr class="open" id="3096">
+ <td><a href="https://cplusplus.github.io/CWG/issues/3096.html">3096</a></td>
+ <td>open</td>
+ <td>Value-dependence of size of structured binding pack with non-dependent initializer</td>
+ <td align="center">Not resolved</td>
+ </tr>
+ <tr class="open" id="3097">
+ <td><a href="https://cplusplus.github.io/CWG/issues/3097.html">3097</a></td>
+ <td>tentatively ready</td>
+ <td>Lambda expression introduces a scope</td>
+ <td align="center">Not resolved</td>
+ </tr>
+ <tr class="open" id="3098">
+ <td><a href="https://cplusplus.github.io/CWG/issues/3098.html">3098</a></td>
+ <td>tentatively ready</td>
+ <td>Remove redundancy "names or designates"</td>
+ <td align="center">Not resolved</td>
+ </tr>
+ <tr class="open" id="3099">
+ <td><a href="https://cplusplus.github.io/CWG/issues/3099.html">3099</a></td>
+ <td>open</td>
+ <td>Instantiation of type aliases from alias templates is unspecified</td>
+ <td align="center">Not resolved</td>
+ </tr>
+ <tr class="open" id="3100">
+ <td><a href="https://cplusplus.github.io/CWG/issues/3100.html">3100</a></td>
+ <td>open</td>
+ <td>Destruction order for objects with static storage duration</td>
+ <td align="center">Not resolved</td>
</tr></table>
</div>
>From 12265313b261c2beaec75f2ffd418c0547ee5d94 Mon Sep 17 00:00:00 2001
From: Richard Smith <richard at metafoo.co.uk>
Date: Thu, 30 Oct 2025 11:52:33 -0700
Subject: [PATCH 2/5] Apply suggestion from @Endilll
Co-authored-by: Vlad Serebrennikov <serebrennikov.vladislav at gmail.com>
---
clang/test/CXX/drs/cwg28xx.cpp | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/clang/test/CXX/drs/cwg28xx.cpp b/clang/test/CXX/drs/cwg28xx.cpp
index 8aa6f629f5311..d0ee191ef23d8 100644
--- a/clang/test/CXX/drs/cwg28xx.cpp
+++ b/clang/test/CXX/drs/cwg28xx.cpp
@@ -64,7 +64,9 @@ namespace cwg2819 { // cwg2819: 19 c++26
namespace cwg2823 { // cwg2823: no
#if __cplusplus >= 201103L
constexpr int *p = 0;
- constexpr int *q1 = &*p; // expected-error {{constant expression}} expected-note {{dereferencing a null pointer}}
+ constexpr int *q1 = &*p;
+ // expected-error at -1 {{constexpr variable 'q1' must be initialized by a constant expression}}
+ // expected-note at -2 {{dereferencing a null pointer is not allowed in a constant expression}}
// FIXME: invalid: dereferencing a null pointer.
constexpr int *q2 = &p[0];
>From c506de0a33113064f70df7482f59881872764323 Mon Sep 17 00:00:00 2001
From: Richard Smith <richard at metafoo.co.uk>
Date: Thu, 30 Oct 2025 11:52:46 -0700
Subject: [PATCH 3/5] Apply suggestion from @Endilll
Co-authored-by: Vlad Serebrennikov <serebrennikov.vladislav at gmail.com>
---
clang/test/CXX/drs/cwg2xx.cpp | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/clang/test/CXX/drs/cwg2xx.cpp b/clang/test/CXX/drs/cwg2xx.cpp
index 2321854b22c4b..f6b573e1138f0 100644
--- a/clang/test/CXX/drs/cwg2xx.cpp
+++ b/clang/test/CXX/drs/cwg2xx.cpp
@@ -242,7 +242,8 @@ namespace cwg212 { // cwg212: yes
// OK, calls void* overload.
int *a = overload(p);
- Base<int> *q = p; // expected-error {{cannot initialize}}
+ Base<int> *q = p;
+ // expected-error at -1 {{cannot initialize a variable of type 'Base<int> *' with an lvalue of type 'Derived<int> *'}}
}
template<typename T> struct Base {};
>From d16e49e7794c60c1c81e10ad7bcbc2076b67fa53 Mon Sep 17 00:00:00 2001
From: Richard Smith <richard at metafoo.co.uk>
Date: Thu, 30 Oct 2025 19:15:17 +0000
Subject: [PATCH 4/5] Address some review comments.
---
clang/test/CXX/drs/cwg0xx.cpp | 18 +-----------------
clang/test/CXX/drs/cwg6.cpp | 36 +++++++++++++++++++++++++++--------
2 files changed, 29 insertions(+), 25 deletions(-)
diff --git a/clang/test/CXX/drs/cwg0xx.cpp b/clang/test/CXX/drs/cwg0xx.cpp
index 1d488b986ad73..10a4f1d6add3a 100644
--- a/clang/test/CXX/drs/cwg0xx.cpp
+++ b/clang/test/CXX/drs/cwg0xx.cpp
@@ -90,23 +90,7 @@ namespace cwg5 { // cwg5: 3.1
const C c = e;
} // namespace cwg5
-namespace cwg6 { // cwg6 codegen is tested in cwg6.cpp
-#if __cplusplus >= 201103L
- struct Counter {
- int copies;
- constexpr Counter(int copies) : copies(copies) {}
- constexpr Counter(const Counter& other) : copies(other.copies + 1) {}
- };
-
- // Passing an lvalue by value makes a non-elidable copy.
- constexpr int PassByValue(Counter c) { return c.copies; }
- constexpr int PassByValue2(Counter c) { return PassByValue(c); }
- constexpr int PassByValue3(Counter c) { return PassByValue2(c); }
- static_assert(PassByValue(Counter(0)) == 0, "expect no copies");
- static_assert(PassByValue2(Counter(0)) == 1, "expect 1 copy");
- static_assert(PassByValue3(Counter(0)) == 2, "expect 2 copies");
-#endif
-} // namespace cwg6
+// cwg6 is in cwg6.cpp
namespace cwg7 { // cwg7: 3.4
class A { public: ~A(); };
diff --git a/clang/test/CXX/drs/cwg6.cpp b/clang/test/CXX/drs/cwg6.cpp
index 888af2acad35a..69080b4b48228 100644
--- a/clang/test/CXX/drs/cwg6.cpp
+++ b/clang/test/CXX/drs/cwg6.cpp
@@ -6,26 +6,46 @@
// RUN: %clang_cc1 -std=c++23 %s -triple x86_64-linux-gnu -emit-llvm -o - -fexceptions -fcxx-exceptions -pedantic-errors | FileCheck %s --check-prefixes CHECK
// RUN: %clang_cc1 -std=c++2c %s -triple x86_64-linux-gnu -emit-llvm -o - -fexceptions -fcxx-exceptions -pedantic-errors | FileCheck %s --check-prefixes CHECK
+#if __cplusplus == 199711L
+#define static_assert(expr) __extension__ _Static_assert(expr)
+#define noexcept throw()
+#endif
+
namespace cwg6 { // cwg6: yes
+#if __cplusplus >= 201103L
+struct Counter {
+ int copies;
+ constexpr Counter(int copies) : copies(copies) {}
+ constexpr Counter(const Counter& other) : copies(other.copies + 1) {}
+};
+
+// Passing an lvalue by value makes a non-elidable copy.
+constexpr int PassByValue(Counter c) { return c.copies; }
+constexpr int PassByValue2(Counter c) { return PassByValue(c); }
+constexpr int PassByValue3(Counter c) { return PassByValue2(c); }
+static_assert(PassByValue(Counter(0)) == 0, "expect no copies");
+static_assert(PassByValue2(Counter(0)) == 1, "expect 1 copy");
+static_assert(PassByValue3(Counter(0)) == 2, "expect 2 copies");
+#endif
struct A {
- A();
- A(const A&);
- ~A();
+ A() noexcept;
+ A(const A&) noexcept;
+ ~A() noexcept;
};
-inline void f(A a) {}
+inline void f(A a) noexcept {}
// CHECK-LABEL: define {{.*}} @_ZN4cwg64callEv
void call() {
A a;
// We copy the parameter here, even though object is not mutated by f and
// otherwise satisfies the criteria for the proposed CWG6 optimization.
- // CHECK: {{call|invoke}} {{.*}} @_ZN4cwg61AC1ERKS0_
- // CHECK: {{call|invoke}} {{.*}} @_ZN4cwg61fE
+ // CHECK: call {{.*}} @_ZN4cwg61AC1ERKS0_(
+ // CHECK: call {{.*}} @_ZN4cwg61fENS_1AE(
f(a);
- // CHECK: {{call|invoke}} {{.*}} @_ZN4cwg61AD1Ev
- // CHECK: {{call|invoke}} {{.*}} @_ZN4cwg61AD1Ev
+ // CHECK: call {{.*}} @_ZN4cwg61AD1Ev(
+ // CHECK: call {{.*}} @_ZN4cwg61AD1Ev(
}
} // namespace cwg6
>From f1bf35be8191167aed443ed4ea7c51cefe7f038d Mon Sep 17 00:00:00 2001
From: Richard Smith <richard at metafoo.co.uk>
Date: Thu, 30 Oct 2025 14:35:37 -0700
Subject: [PATCH 5/5] Avoid "yes".
Co-authored-by: Vlad Serebrennikov <serebrennikov.vladislav at gmail.com>
---
clang/test/CXX/drs/cwg2xx.cpp | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/clang/test/CXX/drs/cwg2xx.cpp b/clang/test/CXX/drs/cwg2xx.cpp
index f6b573e1138f0..a4995ddc2c588 100644
--- a/clang/test/CXX/drs/cwg2xx.cpp
+++ b/clang/test/CXX/drs/cwg2xx.cpp
@@ -230,7 +230,7 @@ namespace cwg211 { // cwg211: 2.7
};
} // namespace cwg211
-namespace cwg212 { // cwg212: yes
+namespace cwg212 { // cwg212: 2.7
template<typename T> struct Base;
template<typename T> struct Derived;
More information about the cfe-commits
mailing list