Thank you!
Tejas
notrealemail at gmail.com
Wed Sep 8 07:27:24 UTC 2021
On Wednesday, 8 September 2021 at 06:03:49 UTC, Tejas wrote:
> I'm not saying a function that returns a `struct` should return
> the struct by reference; but if that function is being used in
> the left hand side of an assignment statement _and_ it is
> returning a **named** value(`_s` here), I think its reasonable
> for the compiler to at least emit a warning that the value
> returned by the function is not usable beyond the scope of that
> statement.
Correction:
the compiler should emit a warning that the value being returned
is a **duplicate** of the variable, and not a reference to the
variable itself, and that the variable cannot be referred to
after the statement ends.
More information about the Digitalmars-d
mailing list