digitalmars.D.bugs - [Issue 22107] New: [scope][dip1000] Can't .dup an array of structs
- d-bugmail puremagic.com (34/34) Jul 06 2021 https://issues.dlang.org/show_bug.cgi?id=22107
https://issues.dlang.org/show_bug.cgi?id=22107 Issue ID: 22107 Summary: [scope][dip1000] Can't .dup an array of structs with impure copy constructor Product: D Version: D2 Hardware: All OS: All Status: NEW Keywords: rejects-valid Severity: normal Priority: P3 Component: druntime Assignee: nobody puremagic.com Reporter: dlang-bugzilla thecybershadow.net Not sure if this is a druntime bug or a compiler bug: //////////////// test.d /////////////// safe unittest { static int i; safe struct S { this(this) { i++; } } void fun(scope S[] values...) safe { values.dup; } } /////////////////////////////////////// $ dmd -o- -unittest -preview=dip1000 test.d test.d(11): Error: scope variable `values` assigned to non-scope parameter `a` calling object.dup!(S).dup --
Jul 06 2021