[Issue 1623] New: Overloading on different parameters numbers gratuitously restrictive.

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sun Oct 28 21:59:22 PDT 2007


http://d.puremagic.com/issues/show_bug.cgi?id=1623

           Summary: Overloading on different parameters numbers gratuitously
                    restrictive.
           Product: D
           Version: 2.007
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: bugzilla at digitalmars.com
        ReportedBy: andrei at metalanguage.com


Consider:

struct uniformInt(IntType)
{
    static uniformInt opCall()(IntType min, IntType max);
    ResultType opCall(UniformRandomNumberGenerator)
        (ref UniformRandomNumberGenerator urng);
}

The compiler does not allow the overloading, although obviously the functions
cannot be confused for one another. This is wrong at multiple levels. Since
struct constructors are not allowed, static opCall is about the only decent way
to create objects. So even if the parameter counts were the same, overloading
should be allowed between static member functions and nonstatic member
functions.


-- 



More information about the Digitalmars-d-bugs mailing list