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: nob...@puremagic.com
          Reporter: default_357-l...@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.

--

Reply via email to