================
@@ -199,3 +199,39 @@ class B3 : A3 {
}; B3(); // expected-error {{deduction guide declaration without trailing
return type}} \
// expected-note {{while building implicit deduction guide first
needed here}}
}
+
+// Also make sure we don't consider conversion functions for copy elision when
+// initializing a base class subobject.
+namespace GH59922 {
+struct Base {
+ Base();
+ Base(Base&&) = delete; // expected-note {{'Base' has been explicitly marked
deleted here}}
+};
+
+Base make_base();
+
+template<typename F>
+struct call_wrapper {
+ F&& f;
+ constexpr operator decltype(auto)() && {
+ return static_cast<F&&>(f)();
+ }
+};
+template<typename F>
+call_wrapper(F&&) -> call_wrapper<F>;
+
+struct Derived : Base {
+ Derived() : Base(call_wrapper{make_base}) {} // expected-error {{call to
deleted constructor of 'Base'}}
+};
+
+struct A {
----------------
Glitch-On wrote:
It's the GH39319 test that Richard suggested in D148474 (deleted copy
constructor, plain `operator A()`), moved from the delegating constructor to a
base class initializer. Like the issue's example, it's accepted by clang 17 and
rejected from 18 on, but it doesn't need the `call_wrapper` template or a
deduced return type. Happy to drop it if the first case is enough.
https://github.com/llvm/llvm-project/pull/232902
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits