digitalmars.D.bugs - [Issue 8815] New: alias modification silently fails on nested fields
- d-bugmail puremagic.com (37/37) Oct 13 2012 http://d.puremagic.com/issues/show_bug.cgi?id=8815
- d-bugmail puremagic.com (8/8) Oct 13 2012 http://d.puremagic.com/issues/show_bug.cgi?id=8815
- d-bugmail puremagic.com (26/26) Jan 26 2013 http://d.puremagic.com/issues/show_bug.cgi?id=8815
http://d.puremagic.com/issues/show_bug.cgi?id=8815 Summary: alias modification silently fails on nested fields Product: D Version: D2 Platform: All OS/Version: All Status: NEW Severity: normal Priority: P2 Component: DMD AssignedTo: nobody puremagic.com ReportedBy: andrej.mitrovich gmail.com 19:48:21 PDT --- property void modify(alias symb)() { symb = new int; } class Foo { this() { modify!(x); modify!(c.x); assert(x); // ok assert(c.x); // fail, c.x. is null } static struct C { int* x; } C c; int* x; } void main() { auto foo = new Foo; } -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Oct 13 2012
http://d.puremagic.com/issues/show_bug.cgi?id=8815 19:59:26 PDT --- But I'm beginning to think using aliases like this isn't the best choice. For one thing it won't work if the alias is a private symbol. It's probably best to use templated functions that take a 'ref' parameter. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Oct 13 2012
http://d.puremagic.com/issues/show_bug.cgi?id=8815 14:05:49 PST --- I can see why, it seems "c.x" gets converted to "this.x": property void init(alias symb)() { pragma(msg, symb); // "this.x", should be "s.x" symb = new int; } class C { this() { init!(s.x); } struct S { int* x; } S s; } void main() { auto c = new C; } Additionally I get this in this sample: core.exception.InvalidMemoryOperationError -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Jan 26 2013