[clang] [clang] Cover CWG issues about `export template` (PR #94876)

Vlad Serebrennikov via cfe-commits cfe-commits at lists.llvm.org
Thu Jun 20 05:01:13 PDT 2024


https://github.com/Endilll updated https://github.com/llvm/llvm-project/pull/94876

>From e4028ec6e70f6d86325393a8d03e407404643bc0 Mon Sep 17 00:00:00 2001
From: Vlad Serebrennikov <serebrennikov.vladislav at gmail.com>
Date: Sun, 9 Jun 2024 00:59:09 +0300
Subject: [PATCH 1/3] [clang] Cover CWG issues about `export template`

---
 clang/test/CXX/drs/cwg2xx.cpp |  2 +-
 clang/test/CXX/drs/cwg3xx.cpp |  4 ++--
 clang/test/CXX/drs/cwg8xx.cpp |  7 +++++++
 clang/www/cxx_dr_status.html  | 20 ++++++++++++++++----
 4 files changed, 26 insertions(+), 7 deletions(-)

diff --git a/clang/test/CXX/drs/cwg2xx.cpp b/clang/test/CXX/drs/cwg2xx.cpp
index 99916dea9a912..926cb19596026 100644
--- a/clang/test/CXX/drs/cwg2xx.cpp
+++ b/clang/test/CXX/drs/cwg2xx.cpp
@@ -41,7 +41,7 @@ namespace cwg202 { // cwg202: 3.1
   template struct X<f>;
 }
 
-// FIXME (export) cwg204: no
+// cwg204: sup 820
 
 namespace cwg206 { // cwg206: yes
   struct S; // #cwg206-S
diff --git a/clang/test/CXX/drs/cwg3xx.cpp b/clang/test/CXX/drs/cwg3xx.cpp
index 94227dc031c6a..a10ed95941ba4 100644
--- a/clang/test/CXX/drs/cwg3xx.cpp
+++ b/clang/test/CXX/drs/cwg3xx.cpp
@@ -377,7 +377,7 @@ namespace cwg322 { // cwg322: 2.8
   int &s = a;
 }
 
-// cwg323: no
+// cwg323: sup 820
 
 namespace cwg324 { // cwg324: 3.6
   struct S { int n : 1; } s; // #cwg324-n
@@ -587,7 +587,7 @@ namespace cwg334 { // cwg334: yes
   template void f<S>();
 }
 
-// cwg335: no
+// cwg335: sup 820
 
 namespace cwg336 { // cwg336: yes
   namespace Pre {
diff --git a/clang/test/CXX/drs/cwg8xx.cpp b/clang/test/CXX/drs/cwg8xx.cpp
index eba601300584d..28fa8083d8e6a 100644
--- a/clang/test/CXX/drs/cwg8xx.cpp
+++ b/clang/test/CXX/drs/cwg8xx.cpp
@@ -10,6 +10,13 @@
 // expected-no-diagnostics
 #endif
 
+namespace cwg820 { // cwg820: 2.7
+export template <class T> struct B {};
+// expected-warning at -1 {{exported templates are unsupported}}
+export template<typename T> void f() {}
+// expected-warning at -1 {{exported templates are unsupported}}
+}
+
 namespace cwg873 { // cwg873: 3.0
 #if __cplusplus >= 201103L
 template <typename T> void f(T &&);
diff --git a/clang/www/cxx_dr_status.html b/clang/www/cxx_dr_status.html
index 43857447d83b1..3fdf6bae0a3d5 100755
--- a/clang/www/cxx_dr_status.html
+++ b/clang/www/cxx_dr_status.html
@@ -1262,7 +1262,7 @@ <h2 id="cxxdr">C++ defect report implementation status</h2>
     <td><a href="https://cplusplus.github.io/CWG/issues/204.html">204</a></td>
     <td>CD1</td>
     <td>Exported class templates</td>
-    <td class="none" align="center">No</td>
+    <td class="full" align="center">Superseded by <a href="#820">820</a></td>
   </tr>
   <tr class="open" id="205">
     <td><a href="https://cplusplus.github.io/CWG/issues/205.html">205</a></td>
@@ -1978,7 +1978,7 @@ <h2 id="cxxdr">C++ defect report implementation status</h2>
     <td><a href="https://cplusplus.github.io/CWG/issues/323.html">323</a></td>
     <td>CD1</td>
     <td>Where must <TT>export</TT> appear?</td>
-    <td class="none" align="center">No</td>
+    <td class="full" align="center">Superseded by <a href="#820">820</a></td>
   </tr>
   <tr id="324">
     <td><a href="https://cplusplus.github.io/CWG/issues/324.html">324</a></td>
@@ -2050,7 +2050,7 @@ <h2 id="cxxdr">C++ defect report implementation status</h2>
     <td><a href="https://cplusplus.github.io/CWG/issues/335.html">335</a></td>
     <td>CD1</td>
     <td>Allowing <TT>export</TT> on template members of nontemplate classes</td>
-    <td class="none" align="center">No</td>
+    <td class="full" align="center">Superseded by <a href="#820">820</a></td>
   </tr>
   <tr id="336">
     <td><a href="https://cplusplus.github.io/CWG/issues/336.html">336</a></td>
@@ -4914,7 +4914,7 @@ <h2 id="cxxdr">C++ defect report implementation status</h2>
     <td><a href="https://cplusplus.github.io/CWG/issues/820.html">820</a></td>
     <td>CD2</td>
     <td>Deprecation of <TT>export</TT></td>
-    <td class="unknown" align="center">Unknown</td>
+    <td class="full" align="center">Clang 2.7</td>
   </tr>
   <tr id="822">
     <td><a href="https://cplusplus.github.io/CWG/issues/822.html">822</a></td>
@@ -17186,6 +17186,18 @@ <h2 id="cxxdr">C++ defect report implementation status</h2>
     <td>open</td>
     <td>Template argument deduction involving exception specifications</td>
     <td align="center">Not resolved</td>
+  </tr>
+  <tr class="open" id="2897">
+    <td><a href="https://cplusplus.github.io/CWG/issues/2897.html">2897</a></td>
+    <td>open</td>
+    <td>Copying potentially-overlapping union subobjects</td>
+    <td align="center">Not resolved</td>
+  </tr>
+  <tr class="open" id="2898">
+    <td><a href="https://cplusplus.github.io/CWG/issues/2898.html">2898</a></td>
+    <td>open</td>
+    <td>Clarify implicit conversion sequence from <I>cv</I> <TT>T</TT> to <TT>T</TT></td>
+    <td align="center">Not resolved</td>
   </tr></table>
 
 </div>

>From bce3e35289aa977e828f6cd76c05e594ff32596b Mon Sep 17 00:00:00 2001
From: Vlad Serebrennikov <serebrennikov.vladislav at gmail.com>
Date: Sun, 9 Jun 2024 01:31:36 +0300
Subject: [PATCH 2/3] Add directives for C++20

---
 clang/test/CXX/drs/cwg8xx.cpp | 24 +++++++++++-------------
 1 file changed, 11 insertions(+), 13 deletions(-)

diff --git a/clang/test/CXX/drs/cwg8xx.cpp b/clang/test/CXX/drs/cwg8xx.cpp
index 28fa8083d8e6a..c8cbdfcee3f4d 100644
--- a/clang/test/CXX/drs/cwg8xx.cpp
+++ b/clang/test/CXX/drs/cwg8xx.cpp
@@ -1,20 +1,18 @@
-// RUN: %clang_cc1 -std=c++98 -triple x86_64-unknown-unknown %s -verify=expected -fexceptions -fcxx-exceptions -pedantic-errors
-// RUN: %clang_cc1 -std=c++11 -triple x86_64-unknown-unknown %s -verify=expected,since-cxx11 -fexceptions -fcxx-exceptions -pedantic-errors
-// RUN: %clang_cc1 -std=c++14 -triple x86_64-unknown-unknown %s -verify=expected,since-cxx11 -fexceptions -fcxx-exceptions -pedantic-errors
-// RUN: %clang_cc1 -std=c++17 -triple x86_64-unknown-unknown %s -verify=expected,since-cxx11 -fexceptions -fcxx-exceptions -pedantic-errors
-// RUN: %clang_cc1 -std=c++20 -triple x86_64-unknown-unknown %s -verify=expected,since-cxx11 -fexceptions -fcxx-exceptions -pedantic-errors
-// RUN: %clang_cc1 -std=c++23 -triple x86_64-unknown-unknown %s -verify=expected,since-cxx11 -fexceptions -fcxx-exceptions -pedantic-errors
-// RUN: %clang_cc1 -std=c++2c -triple x86_64-unknown-unknown %s -verify=expected,since-cxx11 -fexceptions -fcxx-exceptions -pedantic-errors
-
-#if __cplusplus == 199711L
-// expected-no-diagnostics
-#endif
+// RUN: %clang_cc1 -std=c++98 -triple x86_64-unknown-unknown %s -verify=expected,cxx98-17 -fexceptions -fcxx-exceptions -pedantic-errors
+// RUN: %clang_cc1 -std=c++11 -triple x86_64-unknown-unknown %s -verify=expected,cxx98-17,since-cxx11 -fexceptions -fcxx-exceptions -pedantic-errors
+// RUN: %clang_cc1 -std=c++14 -triple x86_64-unknown-unknown %s -verify=expected,cxx98-17,since-cxx11 -fexceptions -fcxx-exceptions -pedantic-errors
+// RUN: %clang_cc1 -std=c++17 -triple x86_64-unknown-unknown %s -verify=expected,cxx98-17,since-cxx11 -fexceptions -fcxx-exceptions -pedantic-errors
+// RUN: %clang_cc1 -std=c++20 -triple x86_64-unknown-unknown %s -verify=expected,since-cxx20,since-cxx11 -fexceptions -fcxx-exceptions -pedantic-errors
+// RUN: %clang_cc1 -std=c++23 -triple x86_64-unknown-unknown %s -verify=expected,since-cxx20,since-cxx11 -fexceptions -fcxx-exceptions -pedantic-errors
+// RUN: %clang_cc1 -std=c++2c -triple x86_64-unknown-unknown %s -verify=expected,since-cxx20,since-cxx11 -fexceptions -fcxx-exceptions -pedantic-errors
 
 namespace cwg820 { // cwg820: 2.7
 export template <class T> struct B {};
-// expected-warning at -1 {{exported templates are unsupported}}
+// cxx98-17-warning at -1 {{exported templates are unsupported}}
+// since-cxx20-error at -2 {{export declaration can only be used within a module purview}}
 export template<typename T> void f() {}
-// expected-warning at -1 {{exported templates are unsupported}}
+// cxx98-17-warning at -1 {{exported templates are unsupported}}
+// since-cxx20-error at -2 {{export declaration can only be used within a module purview}}
 }
 
 namespace cwg873 { // cwg873: 3.0

>From 2108825b801115c462a45ffd9c523915e6ec4f57 Mon Sep 17 00:00:00 2001
From: Vlad Serebrennikov <serebrennikov.vladislav at gmail.com>
Date: Thu, 20 Jun 2024 15:00:57 +0300
Subject: [PATCH 3/3] Use the new colors for superseded CWG issues

---
 clang/www/cxx_dr_status.html | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/clang/www/cxx_dr_status.html b/clang/www/cxx_dr_status.html
index 8ff825006f2b5..1b523cf12854c 100755
--- a/clang/www/cxx_dr_status.html
+++ b/clang/www/cxx_dr_status.html
@@ -1269,7 +1269,7 @@ <h2 id="cxxdr">C++ defect report implementation status</h2>
     <td><a href="https://cplusplus.github.io/CWG/issues/204.html">204</a></td>
     <td>CD1</td>
     <td>Exported class templates</td>
-    <td class="full" align="center">Superseded by <a href="#820">820</a></td>
+    <td class="full-superseded" align="center">Superseded by <a href="#820">820</a></td>
   </tr>
   <tr class="open" id="205">
     <td><a href="https://cplusplus.github.io/CWG/issues/205.html">205</a></td>
@@ -1985,7 +1985,7 @@ <h2 id="cxxdr">C++ defect report implementation status</h2>
     <td><a href="https://cplusplus.github.io/CWG/issues/323.html">323</a></td>
     <td>CD1</td>
     <td>Where must <TT>export</TT> appear?</td>
-    <td class="full" align="center">Superseded by <a href="#820">820</a></td>
+    <td class="full-superseded" align="center">Superseded by <a href="#820">820</a></td>
   </tr>
   <tr id="324">
     <td><a href="https://cplusplus.github.io/CWG/issues/324.html">324</a></td>
@@ -2057,7 +2057,7 @@ <h2 id="cxxdr">C++ defect report implementation status</h2>
     <td><a href="https://cplusplus.github.io/CWG/issues/335.html">335</a></td>
     <td>CD1</td>
     <td>Allowing <TT>export</TT> on template members of nontemplate classes</td>
-    <td class="full" align="center">Superseded by <a href="#820">820</a></td>
+    <td class="full-superseded" align="center">Superseded by <a href="#820">820</a></td>
   </tr>
   <tr id="336">
     <td><a href="https://cplusplus.github.io/CWG/issues/336.html">336</a></td>



More information about the cfe-commits mailing list