[Issue 20682] New: [DIP1000] wrong error: scope variable may not be copied into allocated memory
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Tue Mar 17 16:44:37 UTC 2020
https://issues.dlang.org/show_bug.cgi?id=20682
Issue ID: 20682
Summary: [DIP1000] wrong error: scope variable may not be
copied into allocated memory
Product: D
Version: D2
Hardware: All
OS: All
Status: NEW
Keywords: rejects-valid, safe
Severity: normal
Priority: P1
Component: dmd
Assignee: nobody at puremagic.com
Reporter: ag0aep6g at gmail.com
Similar to issue 20675.
----
struct D
{
int pos;
char* p;
}
int f1(return scope ref D d) @safe
{
return d.pos;
}
ref int f2(return scope ref D d) @safe
{
return d.pos;
}
void test(scope ref D d) @safe
{
int[] da;
da ~= f1(d);
da ~= f2(d);
}
----
--
More information about the Digitalmars-d-bugs
mailing list