December 06, 2017 [Issue 18038] Error: with symbol is shadowing local symbol | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=18038 Simen Kjaeraas <simen.kjaras@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED CC| |simen.kjaras@gmail.com Resolution|--- |INVALID --- Comment #1 from Simen Kjaeraas <simen.kjaras@gmail.com> --- This is intended behavior. https://dlang.org/spec/statement.html#WithStatement: 5. Use of with object symbols that shadow local symbols with the same identifier are not allowed. This is to reduce the risk of inadvertant breakage of with statements when new members are added to the object declaration. struct S { float x; } void main() { int x; S s; with (s) { x++; // error, shadows the int x declaration } } -- |
Copyright © 1999-2021 by the D Language Foundation