[Issue 10921] scoped returns a reference to an uninitialized object
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Thu Aug 29 07:01:01 PDT 2013
http://d.puremagic.com/issues/show_bug.cgi?id=10921
--- Comment #1 from Andrej Mitrovic <andrej.mitrovich at gmail.com> 2013-08-29 07:01:00 PDT ---
Note however that it only fails when declaring, not when assigning. The
following works properly:
-----
import std.conv;
import std.typecons;
class Point
{
this(int x, int y)
{
this.x = x;
this.y = y;
}
int x;
int y;
}
void main()
{
auto p1 = scoped!Point(1, 2);
assert(p1.x == 1, p1.x.text); // ok
assert(p1.y == 2, p1.y.text); // ok
Point p2 = p1;
assert(p2.x == 1, p2.x.text); // ok
assert(p2.y == 2, p2.y.text); // ok
}
-----
--
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
More information about the Digitalmars-d-bugs
mailing list