Skip to content

Commit b91e414

Browse files
EndilllAlexisPerry
authored andcommitted
[clang] Cover CWG issues about export template (llvm#94876)
This PR covers the following Core issues: [CWG204](https://cplusplus.github.io/CWG/issues/204.html) "Exported class templates" [CWG323](https://cplusplus.github.io/CWG/issues/323.html) "Where must `export` appear?" [CWG335](https://cplusplus.github.io/CWG/issues/335.html) "Allowing `export` on template members of nontemplate classes" [CWG820](https://cplusplus.github.io/CWG/issues/820.html) "Deprecation of `export`" I believe the list above is entirety of Core issues that are dedicated solely to `export template`. I believe we have two main points of view here, which command what this PR should do: 1. (easy) Removal of `export template` was done as a defect report in CWG820, and the rest are effectively superseded by it, because we apply defect reports retroactively. 2. (harder) Those Core issues are testable individually, so we should test them for the behavior Core wanted at the time. This PR implements the first option, making our C++ DR status page greener. I think I can be persuaded to go with the second option, if reviewers have strong preference for it.
1 parent ff12cfd commit b91e414

File tree

4 files changed

+22
-17
lines changed

4 files changed

+22
-17
lines changed

clang/test/CXX/drs/cwg2xx.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ namespace cwg202 { // cwg202: 3.1
4141
template struct X<f>;
4242
}
4343

44-
// FIXME (export) cwg204: no
44+
// cwg204: sup 820
4545

4646
namespace cwg206 { // cwg206: yes
4747
struct S; // #cwg206-S

clang/test/CXX/drs/cwg3xx.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -377,7 +377,7 @@ namespace cwg322 { // cwg322: 2.8
377377
int &s = a;
378378
}
379379

380-
// cwg323: no
380+
// cwg323: sup 820
381381

382382
namespace cwg324 { // cwg324: 3.6
383383
struct S { int n : 1; } s; // #cwg324-n
@@ -587,7 +587,7 @@ namespace cwg334 { // cwg334: yes
587587
template void f<S>();
588588
}
589589

590-
// cwg335: no
590+
// cwg335: sup 820
591591

592592
namespace cwg336 { // cwg336: yes
593593
namespace Pre {

clang/test/CXX/drs/cwg8xx.cpp

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,19 @@
1-
// RUN: %clang_cc1 -std=c++98 -triple x86_64-unknown-unknown %s -verify=expected -fexceptions -fcxx-exceptions -pedantic-errors
2-
// RUN: %clang_cc1 -std=c++11 -triple x86_64-unknown-unknown %s -verify=expected,since-cxx11 -fexceptions -fcxx-exceptions -pedantic-errors
3-
// RUN: %clang_cc1 -std=c++14 -triple x86_64-unknown-unknown %s -verify=expected,since-cxx11 -fexceptions -fcxx-exceptions -pedantic-errors
4-
// RUN: %clang_cc1 -std=c++17 -triple x86_64-unknown-unknown %s -verify=expected,since-cxx11 -fexceptions -fcxx-exceptions -pedantic-errors
5-
// RUN: %clang_cc1 -std=c++20 -triple x86_64-unknown-unknown %s -verify=expected,since-cxx11 -fexceptions -fcxx-exceptions -pedantic-errors
6-
// RUN: %clang_cc1 -std=c++23 -triple x86_64-unknown-unknown %s -verify=expected,since-cxx11 -fexceptions -fcxx-exceptions -pedantic-errors
7-
// RUN: %clang_cc1 -std=c++2c -triple x86_64-unknown-unknown %s -verify=expected,since-cxx11 -fexceptions -fcxx-exceptions -pedantic-errors
1+
// RUN: %clang_cc1 -std=c++98 -triple x86_64-unknown-unknown %s -verify=expected,cxx98-17 -fexceptions -fcxx-exceptions -pedantic-errors
2+
// RUN: %clang_cc1 -std=c++11 -triple x86_64-unknown-unknown %s -verify=expected,cxx98-17,since-cxx11 -fexceptions -fcxx-exceptions -pedantic-errors
3+
// RUN: %clang_cc1 -std=c++14 -triple x86_64-unknown-unknown %s -verify=expected,cxx98-17,since-cxx11 -fexceptions -fcxx-exceptions -pedantic-errors
4+
// RUN: %clang_cc1 -std=c++17 -triple x86_64-unknown-unknown %s -verify=expected,cxx98-17,since-cxx11 -fexceptions -fcxx-exceptions -pedantic-errors
5+
// RUN: %clang_cc1 -std=c++20 -triple x86_64-unknown-unknown %s -verify=expected,since-cxx20,since-cxx11 -fexceptions -fcxx-exceptions -pedantic-errors
6+
// RUN: %clang_cc1 -std=c++23 -triple x86_64-unknown-unknown %s -verify=expected,since-cxx20,since-cxx11 -fexceptions -fcxx-exceptions -pedantic-errors
7+
// RUN: %clang_cc1 -std=c++2c -triple x86_64-unknown-unknown %s -verify=expected,since-cxx20,since-cxx11 -fexceptions -fcxx-exceptions -pedantic-errors
88

9-
#if __cplusplus == 199711L
10-
// expected-no-diagnostics
11-
#endif
9+
namespace cwg820 { // cwg820: 2.7
10+
export template <class T> struct B {};
11+
// cxx98-17-warning@-1 {{exported templates are unsupported}}
12+
// since-cxx20-error@-2 {{export declaration can only be used within a module purview}}
13+
export template<typename T> void f() {}
14+
// cxx98-17-warning@-1 {{exported templates are unsupported}}
15+
// since-cxx20-error@-2 {{export declaration can only be used within a module purview}}
16+
}
1217

1318
namespace cwg873 { // cwg873: 3.0
1419
#if __cplusplus >= 201103L

clang/www/cxx_dr_status.html

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1269,7 +1269,7 @@ <h2 id="cxxdr">C++ defect report implementation status</h2>
12691269
<td><a href="https://cplusplus.github.io/CWG/issues/204.html">204</a></td>
12701270
<td>CD1</td>
12711271
<td>Exported class templates</td>
1272-
<td class="none" align="center">No</td>
1272+
<td class="full-superseded" align="center">Superseded by <a href="#820">820</a></td>
12731273
</tr>
12741274
<tr class="open" id="205">
12751275
<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>
19851985
<td><a href="https://cplusplus.github.io/CWG/issues/323.html">323</a></td>
19861986
<td>CD1</td>
19871987
<td>Where must <TT>export</TT> appear?</td>
1988-
<td class="none" align="center">No</td>
1988+
<td class="full-superseded" align="center">Superseded by <a href="#820">820</a></td>
19891989
</tr>
19901990
<tr id="324">
19911991
<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>
20572057
<td><a href="https://cplusplus.github.io/CWG/issues/335.html">335</a></td>
20582058
<td>CD1</td>
20592059
<td>Allowing <TT>export</TT> on template members of nontemplate classes</td>
2060-
<td class="none" align="center">No</td>
2060+
<td class="full-superseded" align="center">Superseded by <a href="#820">820</a></td>
20612061
</tr>
20622062
<tr id="336">
20632063
<td><a href="https://cplusplus.github.io/CWG/issues/336.html">336</a></td>
@@ -4921,7 +4921,7 @@ <h2 id="cxxdr">C++ defect report implementation status</h2>
49214921
<td><a href="https://cplusplus.github.io/CWG/issues/820.html">820</a></td>
49224922
<td>CD2</td>
49234923
<td>Deprecation of <TT>export</TT></td>
4924-
<td class="unknown" align="center">Unknown</td>
4924+
<td class="full" align="center">Clang 2.7</td>
49254925
</tr>
49264926
<tr id="822">
49274927
<td><a href="https://cplusplus.github.io/CWG/issues/822.html">822</a></td>

0 commit comments

Comments
 (0)