[clang] [clang] Add test for CWG794 "Base-derived conversion in member type of pointer-to-member conversion" (PR #121660)
via cfe-commits
cfe-commits at lists.llvm.org
Sun Jan 5 01:10:08 PST 2025
================
@@ -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::*': different classes ('Y' vs 'cwg794::X')}}
+// FIXME: why diagnostic says just `Y` and not `cwg794::Y`, like `cwg794::X`?
----------------
cor3ntin wrote:
That seems to occur in `HandleFunctionTypeMismatch` - my best guess is that one is a canonical type and the other isn't? Not sure though
https://github.com/llvm/llvm-project/pull/121660
More information about the cfe-commits
mailing list