www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 23235] New: [DIP1000] Inconsistent error messages for

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

          Issue ID: 23235
           Summary: [DIP1000] Inconsistent error messages for typesafe
                    variadic parameter
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: snarwin+bugzilla gmail.com

When attempting to compile the following example program with -preview=dip1000:

---
import std;
 safe:
void fun1(string[] foo...) {    
    writeln(foo);
}

void fun2(string[] bar...) {    
    fun1(bar);
}

void main() {
    fun2("foo", "bar");    
}
---

DMD 2.100.0 produces the following error messages:

---
bug.d(4): Error: scope variable `foo` assigned to non-scope parameter
`_param_0` calling std.stdio.writeln!(string[]).writeln
bug.d(8): Error: scope variable `bar` assigned to non-scope parameter `foo`
calling bug.fun1
---

In the first message, foo is called a "scope variable"; in the second, a
"non-scope parameter". Both cannot be true.

--
Jul 09 2022