Bug 23235 – [DIP1000] typesafe variadic parameters should automatically be scope

Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2022-07-09T12:13:16Z
Last change time
2022-07-24T13:00:39Z
Keywords
diagnostic, pull, safe
Assigned to
No Owner
Creator
Paul Backus

Comments

Comment #0 by snarwin+bugzilla — 2022-07-09T12:13:16Z
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.
Comment #1 by bugzilla — 2022-07-24T01:13:54Z
Equivalent test case that does not import all of Phobos: @safe: void awkk(string[] ppp...) { } void bark(string[] foo...) { awkk(foo); } void cack(string[] bar...) { bark(bar); } void test() { cack("abc", "def"); }
Comment #2 by dlang-bot — 2022-07-24T01:28:34Z
@WalterBright created dlang/dmd pull request #14324 "fix Issue 23235 - [DIP1000] typesafe variadic parameters should autom…" fixing this issue: - fix Issue 23235 - [DIP1000] typesafe variadic parameters should automatically be scope https://github.com/dlang/dmd/pull/14324
Comment #3 by dlang-bot — 2022-07-24T13:00:39Z
dlang/dmd pull request #14324 "fix Issue 23235 - [DIP1000] typesafe variadic parameters should autom…" was merged into master: - a879fdbde5f7159b3f277e544968dba40754abf4 by Walter Bright: fix Issue 23235 - [DIP1000] typesafe variadic parameters should automatically be scope https://github.com/dlang/dmd/pull/14324