Skip to content

Conversation

@Endilll
Copy link
Contributor

@Endilll Endilll commented Jan 4, 2025

This patch adds a test for CWG794, which is an NB comment closed as NAD. Author was asked to bring a paper to Evolution, which never happened. So we test for the absence of base-derived conversion in pointer-to-member conversion.

@Endilll Endilll added clang Clang issues not falling into any other category c++ labels Jan 4, 2025
@Endilll Endilll requested review from cor3ntin and shafik January 4, 2025 18:56
@llvmbot
Copy link
Member

llvmbot commented Jan 4, 2025

@llvm/pr-subscribers-clang

Author: Vlad Serebrennikov (Endilll)

Changes

This patch adds a test for CWG794, which is an NB comment closed as NAD. Author was asked to bring a paper to Evolution, which never happened. So we test for the absence of base-derived conversion in pointer-to-member conversion.


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

2 Files Affected:

  • (modified) clang/test/CXX/drs/cwg7xx.cpp (+12)
  • (modified) clang/www/cxx_dr_status.html (+1-1)
diff --git a/clang/test/CXX/drs/cwg7xx.cpp b/clang/test/CXX/drs/cwg7xx.cpp
index 507eb8fb714350..842d172d379005 100644
--- a/clang/test/CXX/drs/cwg7xx.cpp
+++ b/clang/test/CXX/drs/cwg7xx.cpp
@@ -337,3 +337,15 @@ template <typename... T>
 void h(int i = 0, T ...args, int j = 1) {}
 #endif
 }
+
+namespace cwg794 { // cwg794: 2.7
+struct B {};
+struct D : B {};
+struct X {
+  D d;
+};
+struct Y : X {};
+B Y::*pm = &X::d;
+// expected-error@-1 {{cannot initialize a variable of type 'B Y::*' with an rvalue of type 'D cwg794::X::*': different classes ('Y' vs 'cwg794::X')}}
+// FIXME: why diagnostic says just `Y` and not `cwg794::Y`, like `cwg794::X`?
+} // namespace cwg794
diff --git a/clang/www/cxx_dr_status.html b/clang/www/cxx_dr_status.html
index c069e155fd547c..98766b71d42845 100755
--- a/clang/www/cxx_dr_status.html
+++ b/clang/www/cxx_dr_status.html
@@ -4775,7 +4775,7 @@ <h2 id="cxxdr">C++ defect report implementation status</h2>
     <td><a href="https://cplusplus.github.io/CWG/issues/794.html">794</a></td>
     <td>NAD</td>
     <td>Base-derived conversion in member type of pointer-to-member conversion</td>
-    <td class="unknown" align="center">Unknown</td>
+    <td class="full" align="center">Clang 2.7</td>
   </tr>
   <tr id="795">
     <td><a href="https://cplusplus.github.io/CWG/issues/795.html">795</a></td>

Comment on lines +349 to +350
// expected-error@-1 {{cannot initialize a variable of type 'B Y::*' with an rvalue of type 'D cwg794::X::*': different classes ('Y' vs 'cwg794::X')}}
// FIXME: why diagnostic says just `Y` and not `cwg794::Y`, like `cwg794::X`?
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That seems to occur in HandleFunctionTypeMismatch - my best guess is that one is a canonical type and the other isn't? Not sure though

@Endilll Endilll merged commit 3321c2d into llvm:main Jan 5, 2025
11 checks passed
@Endilll Endilll deleted the cwg794 branch January 5, 2025 09:17
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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants