[Issue 21572] New: Implicit conversion from `immutable(T)[][]` to `scope const(T)[][]` is missing

d-bugmail at puremagic.com d-bugmail at puremagic.com
Fri Jan 22 11:22:27 UTC 2021


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

          Issue ID: 21572
           Summary: Implicit conversion from `immutable(T)[][]` to `scope
                    const(T)[][]` is missing
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: major
          Priority: P1
         Component: dmd
          Assignee: nobody at puremagic.com
          Reporter: per.nordlow at gmail.com

In

@safe:
void f(scope const(char)[]) {}
void g(scope const(char)[][]) {}
unittest
{
    string x;
    f(x);
    string[] y;
    g(y);
}

g() should be allowed. Instead it currently fails

function `foo.g(scope const(char)[][] _param_0)` is not callable using argument
types `(string[])` (d-dmd)
cannot pass argument `y` of type `string[]` to parameter `scope const(char)[][]
_param_0` (d-dmd)

Perhaps conversion should be allowed in `g()` without `scope` qualifier as long
as `f()` allows it.

--


More information about the Digitalmars-d-bugs mailing list