[Issue 17977] New: [scope] escaping reference to a temporary struct instance
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Fri Nov 10 22:01:36 UTC 2017
https://issues.dlang.org/show_bug.cgi?id=17977
Issue ID: 17977
Summary: [scope] escaping reference to a temporary struct
instance
Product: D
Version: D2
Hardware: All
OS: All
Status: NEW
Severity: normal
Priority: P1
Component: dmd
Assignee: nobody at puremagic.com
Reporter: bugzilla at digitalmars.com
The following code:
struct List {
Elem front() @safe return scope;
~this() @trusted scope;
@disable this(this);
void* data;
}
struct Elem {
void* data;
}
void test() @safe {
Elem elem;
{
// error: elem gets a pointer that has a lifetime limited to List()
elem = List().front;
}
}
--
More information about the Digitalmars-d-bugs
mailing list