Skip to content

Commit 0b021c4

Browse files
authored
[clang] Claim conformance for CWG466 (llvm#87748)
[CWG466](https://cplusplus.github.io/CWG/issues/466.html) "cv-qualifiers on pseudo-destructor type". Richard claimed that we don't implement this DR because of one ill-formed example being accepted: `a->CI::~VI();`. This example is testing the behavior of calling a pseudo-destructor via a qualified name, where components of qualified name denote the same `int` type, but with different cv-qualifications. Initially, the following wording from [expr.pseudo] quoted in CWG466 was left intact: > Furthermore, the two type-names in a pseudo-destructor-name of the form > > `:: (opt) nested-name-specifier (opt) type-name ::~ type-name` > >shall designate the same scalar type. According to this wording, the example is indeed ill-formed. [P1131R2](https://wg21.link/p1131r2) merged wording for pseudo-destructors into regular destructor wording. Among other things, [expr.pseudo] was removed, and [expr.prim.id.qual]/2 was changed to read: > Where `type-name ::~ type-name` is used, the two type-names shall refer to the same type (ignoring cv-qualifications); I believe P1131R2 made the example well-formed. However, this wording didn't survive [P1787R6](https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2020/p1787r6.html) "Declarations and where to find them". In that paper I don't see the intent to make the example ill-formed again, so I assume it confirmed status-quo via other wording. My _guess_ the new wording is http://eel.is/c++draft/basic.lookup#qual.general-4.6: > If a qualified name Q follows a ~: > - <...> > - The [type-name](http://eel.is/c++draft/dcl.type.simple#nt:type-name) that is or contains Q shall refer to its (original) lookup context (ignoring cv-qualification) under the interpretation established by at least one (successful) lookup performed[.](http://eel.is/c++draft/basic.lookup#qual.general-4.6.sentence-1)
1 parent cd0f5b2 commit 0b021c4

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

clang/test/CXX/drs/dr4xx.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -948,7 +948,7 @@ namespace dr460 { // dr460: yes
948948
// dr464: na
949949
// dr465: na
950950

951-
namespace dr466 { // dr466: no
951+
namespace dr466 { // dr466: 2.8
952952
typedef int I;
953953
typedef const int CI;
954954
typedef volatile int VI;
@@ -960,7 +960,7 @@ namespace dr466 { // dr466: no
960960
a->CI::~CI();
961961
a->VI::~VI();
962962

963-
a->CI::~VI(); // FIXME: This is invalid; CI and VI are not the same scalar type.
963+
a->CI::~VI(); // allowed by changes to [expr.id.prim.qual]/2 introduced in P1131R2
964964

965965
b->~I();
966966
b->~CI();

clang/www/cxx_dr_status.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2836,7 +2836,7 @@ <h2 id="cxxdr">C++ defect report implementation status</h2>
28362836
<td><a href="https://cplusplus.github.io/CWG/issues/466.html">466</a></td>
28372837
<td>CD1</td>
28382838
<td>cv-qualifiers on pseudo-destructor type</td>
2839-
<td class="none" align="center">No</td>
2839+
<td class="full" align="center">Clang 2.8</td>
28402840
</tr>
28412841
<tr id="467">
28422842
<td><a href="https://cplusplus.github.io/CWG/issues/467.html">467</a></td>

0 commit comments

Comments
 (0)