Bug 19578 – Generated function parameter names may shadow existing symbols

Status
RESOLVED
Resolution
DUPLICATE
Severity
minor
Priority
P3
Component
dmd
Product
D
Version
D2
Platform
x86_64
OS
Linux
Creation time
2019-01-12T22:15:47Z
Last change time
2023-04-25T14:30:03Z
Keywords
bootcamp, trivial
Assigned to
No Owner
Creator
Paul Backus

Comments

Comment #0 by snarwin+bugzilla — 2019-01-12T22:15:47Z
The following program should print "free variable", but instead prints "parameter": --- import std.stdio; string _param_0 = "free variable"; void fun(string) { writeln(_param_0); } void main() { fun("parameter"); } ---
Comment #1 by razvan.nitu1305 — 2023-04-25T12:59:46Z
I'm not certain what we can do in this situation. Apart from maybe adding a second underscore; that way we will be covered by the spec. Is that what this bug report is asking for?
Comment #2 by razvan.nitu1305 — 2023-04-25T13:02:58Z
To be clear, I don't think that adding a special rule to make name resolution bypass the generated name is worth it.
Comment #3 by snarwin+bugzilla — 2023-04-25T13:22:46Z
Yes, adding a second underscore would fix this.
Comment #4 by razvan.nitu1305 — 2023-04-25T14:30:03Z
*** This issue has been marked as a duplicate of issue 19454 ***