digitalmars.D.bugs - [Issue 12578] New: Allow local function overloading
- d-bugmail puremagic.com (52/53) Apr 14 2014 https://issues.dlang.org/show_bug.cgi?id=12578
https://issues.dlang.org/show_bug.cgi?id=12578 Issue ID: 12578 Summary: Allow local function overloading Product: D Version: D2 Hardware: All OS: All Status: NEW Severity: enhancement Priority: P1 Component: DMD Assignee: nobody puremagic.com Reporter: monarchdodra gmail.comFrom the conversation:http://forum.dlang.org/thread/gxzqflbxjmlewdsfwykt forum.dlang.org Basically, this fails: //---- void main() { void foo(); void foo(int); } //---- Error: declaration foo is already defined //---- I *think* this is according to spec? However, I find this behavior unrational, since you can get it to work with a simple wrap: //---- void main() { static struct S { static void foo(); static void foo(int); } alias foo = S.foo; } //---- Fine! No problem! //---- Given that the second example compiles, I think the D language should allow local function overloading. ... Or, if the issue is one of scope/context/forwardreferences (?) to at least allow overloading of static local functions, eg: //---- void main() { static void foo(); static void foo(int); } //---- --
Apr 14 2014