[Issue 20821] New: Aliased template method confuses overload resolution

d-bugmail at puremagic.com d-bugmail at puremagic.com
Mon May 11 13:12:24 UTC 2020


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

          Issue ID: 20821
           Summary: Aliased template method confuses overload resolution
           Product: D
           Version: D2
          Hardware: x86
                OS: Windows
            Status: NEW
          Severity: normal
          Priority: P1
         Component: dmd
          Assignee: nobody at puremagic.com
          Reporter: simen.kjaras at gmail.com

struct S {
    int gun()(int i) { return 0; }
    alias fun = gun;
    int fun() { return 1; }
}

static assert(S().fun == 1); // Error

The above code gives the error message 'void has no value'. It seems it
believes I'm referring to gun, while I'm in fact trying to call fun().

If an alias is not used, and gun is called fun instead, the above code works
correctly.

--


More information about the Digitalmars-d-bugs mailing list