[Issue 19891] New: Confusing error message for auto ref parameters with default values

d-bugmail at puremagic.com d-bugmail at puremagic.com
Wed May 22 23:11:35 UTC 2019


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

          Issue ID: 19891
           Summary: Confusing error message for auto ref parameters with
                    default values
           Product: D
           Version: D2
          Hardware: x86_64
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P1
         Component: dmd
          Assignee: nobody at puremagic.com
          Reporter: yshuiv7 at gmail.com

void fun(R)(auto ref int a, auto ref R r = 1) {}

void main() {
    fun(10, 2); // Error: cannot modify constant `1`
    fun(10); // Error: `auto` can only be used as part of `auto ref` for
template function parameters
}

The error messages make sense in neither of the cases.

--


More information about the Digitalmars-d-bugs mailing list