Warning on self assignment

Mike Franklin slavo5150 at yahoo.com
Wed Apr 25 01:20:13 UTC 2018


On Wednesday, 25 April 2018 at 01:08:46 UTC, Arun Chandrasekaran 
wrote:
> So I was telling my colleague that D would warn on self 
> assignment, but found that I was wrong.
>
> https://run.dlang.io/is/HLhtek
>
> ```
> module a;
>
> import std.stdio;
>
> void main() {
>     string a;
>     a = a;          // Can the compiler warn at this line that 
> there is no effect?
>     writeln(a);
>     return;
> }
> ```

It appears a bug has already been filed 
(https://issues.dlang.org/show_bug.cgi?id=11970).  I'll see if I 
can fix it.

Mike


More information about the Digitalmars-d-learn mailing list