You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
A diagnostic indicating that
a non-operator=out this function is not supported, and
to write a non-this function instead.
Since calling the function would require member access (and thus an object),
a non-operator=out this function can't be supported.
It might be possible to make it work.
A non-operator=out this function could be lowered to Cpp1 as a friend.
Then UFCS on (out x).f(args...); could call it.
And out this on a non-operator= function is disabled because the only way for it to be useful would be to allow calling the function on an uninitialized object. I may allow that extension, but it seems a bit novel and I want to see actual motivating use cases down the road before spending time allowing and teaching it.
-- #266 (comment) (extract)
The main difference I mean above is that if I were to allow a non-operator=member function to have an outthis parameter specifically, say a member function f(out this), then I could (but don't yet) allow out also on the front of the function call, i.e., a syntax like outmyobject.f(). Because a member function has access to the class's private data, such a member function could potentially also choose how to directly construct the individual members of the class (whereas other out parameters can construct the object but only using the provided constructors). Other than that granularity, though, cppfront already allows any function with an out parameter to act as a delegating constructor.(*)
-- #266 (comment) (extract)
Title: Non-
operator=
out this
function triggers assertion.Minimal reproducer (https://cpp2.godbolt.org/z/KG7rW4an9):
Commands:
Expected result:
A diagnostic indicating that
a non-
operator=
out this
function is not supported, andto write a non-
this
function instead.Since calling the function would require member access (and thus an object),
a non-
operator=
out this
function can't be supported.It might be possible to make it work.
A non-
operator=
out this
function could be lowered to Cpp1 as afriend
.Then UFCS on
(out x).f(args...);
could call it.Actual result and error:
Other observations:
I came up with this after writing a setter.
I was curious as to what would happen if I mis-typed
out
instead ofinout
.The text was updated successfully, but these errors were encountered: