On Saturday, 13 June 2020 at 12:47:31 UTC, Stanislav Blinov wrote:
[...]
The temporary exists until the end of full expression, or until
the end of enclosing statement. It is simply not an lvalue for
the caller, but it certainly exists, and so its interface must
function.
So public data members are not part of the interface? I
understand that it probably doesn't make much sense to mutate
data members of an rvalue but this just looks very inconsistent
to me, in particular if you consider the fact that you can also
call member functions with the = syntax:
```
struct A
{
auto a(int _a)
{
return this._a = _a;
}
int _a = 0;
}
void main
{
static assert(__traits(compiles, { A().a = 2; })); // this is
ok but looks like it shouldn’t be
}
```