www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 19454] New: Name collisions with unnamed function parameters

https://issues.dlang.org/show_bug.cgi?id=19454

          Issue ID: 19454
           Summary: Name collisions with unnamed function parameters
           Product: D
           Version: D2
          Hardware: x86_64
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: dhasenan gmail.com

Example:
---
void foo(int _param_1, int) {}
---

Result is a compile error:
Error: function `scratch.foo` parameter foo._param_1 is already defined

Double-underscore identifiers are reserved by the compiler, but other
identifiers are not. The fix is to change _param_[index] to __param_[index],
presumably. That won't change the name collision, but it will at least move it
to "here be dragons" territory instead of "this looks like it should work".

--
Nov 30 2018