Skip to content

Commit 3321c2d

Browse files
authored
[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.
1 parent fbc198c commit 3321c2d

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

clang/test/CXX/drs/cwg7xx.cpp

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -337,3 +337,15 @@ template <typename... T>
337337
void h(int i = 0, T ...args, int j = 1) {}
338338
#endif
339339
}
340+
341+
namespace cwg794 { // cwg794: 2.7
342+
struct B {};
343+
struct D : B {};
344+
struct X {
345+
D d;
346+
};
347+
struct Y : X {};
348+
B Y::*pm = &X::d;
349+
// 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')}}
350+
// FIXME: why diagnostic says just `Y` and not `cwg794::Y`, like `cwg794::X`?
351+
} // namespace cwg794

clang/www/cxx_dr_status.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4775,7 +4775,7 @@ <h2 id="cxxdr">C++ defect report implementation status</h2>
47754775
<td><a href="https://cplusplus.github.io/CWG/issues/794.html">794</a></td>
47764776
<td>NAD</td>
47774777
<td>Base-derived conversion in member type of pointer-to-member conversion</td>
4778-
<td class="unknown" align="center">Unknown</td>
4778+
<td class="full" align="center">Clang 2.7</td>
47794779
</tr>
47804780
<tr id="795">
47814781
<td><a href="https://cplusplus.github.io/CWG/issues/795.html">795</a></td>

0 commit comments

Comments
 (0)