C++ Logo

std-discussion

Advanced search

Re: Deleting the Rvalue member function

From: Lénárd Szolnoki <cpp_at_[hidden]>
Date: Fri, 30 Dec 2022 12:59:24 +0000
Hi,

On 30 December 2022 12:50:09 GMT, Frederick Virchanza Gotham via Std-Discussion <std-discussion_at_[hidden]> wrote:
>On Wednesday, December 28, 2022, Matthew House via Std-Discussion <
>std-discussion_at_[hidden]> wrote:
>
>>
>> Meanwhile, Dog::operator& is a viable function for &move(d), since a
>> reference of type const volatile Dog&& can bind directly to xvalue
>> move(d). Therefore, overload resolution selects Dog::operator& for
>> &move(d), resulting in an error, since the function is defined as
>> deleted.
>>
>
>
>
>Do you reckon it should be a compiler error to delete the unary '&'
>operator for Rvalues? Should I post to the proposals group to make it a
>compiler error in C++26?

What would be the reasoning? I mean not many operator& overloads make sense, including a deleted rvalue one, but I don't see a reason to needlessly introduce a corner case to the language.

Cheers,
Lénárd

Received on 2022-12-30 12:59:29