[Issue 23235] New: [DIP1000] Inconsistent error messages for typesafe variadic parameter
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Sat Jul 9 12:13:16 UTC 2022
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 at puremagic.com
Reporter: snarwin+bugzilla at 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.
--
More information about the Digitalmars-d-bugs
mailing list