[Issue 23956] New: [REG2.099.0] Can't decide between const and non-const overload with lambda

d-bugmail at puremagic.com d-bugmail at puremagic.com
Fri Jun 2 15:59:40 UTC 2023


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

          Issue ID: 23956
           Summary: [REG2.099.0] Can't decide between const and non-const
                    overload with lambda
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Keywords: rejects-valid
          Severity: regression
          Priority: P1
         Component: dmd
          Assignee: nobody at puremagic.com
          Reporter: dlang-bugzilla at thecybershadow.net

//////////////////////// test.d ////////////////////////
struct S
{
    void fun(scope void delegate(      int []))       {}
    void fun(scope void delegate(const(int)[])) const {}
}

unittest
{
    S s;
    s.fun((arr) {});
}
////////////////////////////////////////////////////////

Compiler says:

test.d(10): Error: `test.S.fun` called with argument types `(void)` matches
both:
test.d(3):     `test.S.fun(scope void delegate(int[]) _param_0)`
and:
test.d(4):     `test.S.fun(scope void delegate(const(int)[]) _param_0) const`

Looks very similar to issue 23274, may be the same underlying bug.

--


More information about the Digitalmars-d-bugs mailing list