digitalmars.D.bugs - [Issue 22862] New: Functions cannot be overloaded on return value
- d-bugmail puremagic.com (22/22) Mar 08 2022 https://issues.dlang.org/show_bug.cgi?id=22862
https://issues.dlang.org/show_bug.cgi?id=22862 Issue ID: 22862 Summary: Functions cannot be overloaded on return value alone. Product: D Version: D2 Hardware: x86_64 OS: Linux Status: NEW Severity: enhancement Priority: P1 Component: dmd Assignee: nobody puremagic.com Reporter: default_357-line yahoo.de If you attempt to write code like this: int foo() { } float foo() { } you get an error: foo conflicts with previous declaration. Allowing this seems clearly pointless, since overloads that only differ by return value cannot be differentiated on call, but they *can* be differentiated by traits, ie. getOverloads. As such, it would be nice if the arbitrary restriction on overloading functions with the same parameter types was removed. --
Mar 08 2022