[clang] 3321c2d - [clang] Add test for CWG794 "Base-derived conversion in member type of pointer-to-member conversion" (#121660)

via cfe-commits cfe-commits at lists.llvm.org
Sun Jan 5 01:17:18 PST 2025


Author: Vlad Serebrennikov
Date: 2025-01-05T13:17:15+04:00
New Revision: 3321c2d72ab7757dbdd38bdd99a76d89293dac8a

URL: https://github.com/llvm/llvm-project/commit/3321c2d72ab7757dbdd38bdd99a76d89293dac8a
DIFF: https://github.com/llvm/llvm-project/commit/3321c2d72ab7757dbdd38bdd99a76d89293dac8a.diff

LOG: [clang] Add test for CWG794 "Base-derived conversion in member type of pointer-to-member conversion" (#121660)

This patch adds a test for
[CWG794](https://cplusplus.github.io/CWG/issues/794.html), 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.

Added: 
    

Modified: 
    clang/test/CXX/drs/cwg7xx.cpp
    clang/www/cxx_dr_status.html

Removed: 
    


################################################################################
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 at -1 {{cannot initialize a variable of type 'B Y::*' with an rvalue of type 'D cwg794::X::*': 
diff erent 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 239c05e7823846..d767d2973b57ef 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>


        


More information about the cfe-commits mailing list