Skip to content

[clang] Claim conformance for CWG466 #87748

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 6, 2024
Merged

[clang] Claim conformance for CWG466 #87748

merged 1 commit into from
Apr 6, 2024

Conversation

Endilll
Copy link
Contributor

@Endilll Endilll commented Apr 5, 2024

CWG466 "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 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 "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 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.

@Endilll Endilll added clang Clang issues not falling into any other category test-suite c++ labels Apr 5, 2024
@llvmbot
Copy link
Member

llvmbot commented Apr 5, 2024

@llvm/pr-subscribers-clang

Author: Vlad Serebrennikov (Endilll)

Changes

CWG466 "cv-qualifiers on pseudo-destructor type".
Richard claimed that we don't implement this DR because of one ill-formed example being accepted: a-&gt;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 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 "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 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.


Full diff: https://github.com/llvm/llvm-project/pull/87748.diff

2 Files Affected:

  • (modified) clang/test/CXX/drs/dr4xx.cpp (+2-2)
  • (modified) clang/www/cxx_dr_status.html (+1-1)
diff --git a/clang/test/CXX/drs/dr4xx.cpp b/clang/test/CXX/drs/dr4xx.cpp
index 343c4ee6f3344e..34dd638c1d9b00 100644
--- a/clang/test/CXX/drs/dr4xx.cpp
+++ b/clang/test/CXX/drs/dr4xx.cpp
@@ -948,7 +948,7 @@ namespace dr460 { // dr460: yes
 // dr464: na
 // dr465: na
 
-namespace dr466 { // dr466: no
+namespace dr466 { // dr466: 2.8
   typedef int I;
   typedef const int CI;
   typedef volatile int VI;
@@ -960,7 +960,7 @@ namespace dr466 { // dr466: no
     a->CI::~CI();
     a->VI::~VI();
 
-    a->CI::~VI(); // FIXME: This is invalid; CI and VI are not the same scalar type.
+    a->CI::~VI(); // allowed by changes to [expr.id.prim.qual]/2 introduced in P1131R2
 
     b->~I();
     b->~CI();
diff --git a/clang/www/cxx_dr_status.html b/clang/www/cxx_dr_status.html
index 5e1e03dec1d484..887eaa1bdcd55f 100755
--- a/clang/www/cxx_dr_status.html
+++ b/clang/www/cxx_dr_status.html
@@ -2836,7 +2836,7 @@ <h2 id="cxxdr">C++ defect report implementation status</h2>
     <td><a href="https://cplusplus.github.io/CWG/issues/466.html">466</a></td>
     <td>CD1</td>
     <td>cv-qualifiers on pseudo-destructor type</td>
-    <td class="none" align="center">No</td>
+    <td class="full" align="center">Clang 2.8</td>
   </tr>
   <tr id="467">
     <td><a href="https://cplusplus.github.io/CWG/issues/467.html">467</a></td>

@cor3ntin
Copy link
Contributor

cor3ntin commented Apr 5, 2024

I agree with that (the new wording in [basic.lookup.qual.general] ignore cv qualifications)

@Endilll Endilll requested review from AaronBallman and shafik April 5, 2024 07:55
@Endilll Endilll merged commit 0b021c4 into llvm:main Apr 6, 2024
@Endilll Endilll deleted the dr466 branch April 6, 2024 04:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
c++ clang Clang issues not falling into any other category test-suite
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants