digitalmars.D.bugs - [Issue 2929] New: Alias this when this is null
- d-bugmail puremagic.com (30/30) May 03 2009 http://d.puremagic.com/issues/show_bug.cgi?id=2929
- d-bugmail puremagic.com (12/12) Feb 14 2012 http://d.puremagic.com/issues/show_bug.cgi?id=2929
- d-bugmail puremagic.com (11/11) Feb 14 2012 http://d.puremagic.com/issues/show_bug.cgi?id=2929
- d-bugmail puremagic.com (13/13) Feb 04 2013 http://d.puremagic.com/issues/show_bug.cgi?id=2929
http://d.puremagic.com/issues/show_bug.cgi?id=2929 Summary: Alias this when this is null Product: D Version: 2.029 Platform: PC OS/Version: Linux Status: NEW Severity: normal Priority: P2 Component: DMD AssignedTo: bugzilla digitalmars.com ReportedBy: jason.james.house gmail.com The code below should demonstrate the problem. The implicit use of alias this is not null-aware. That means that a nullable class reference with alias this to another reference type is used, then segfaults will occur. The only workaround is to define an intermediate variable and test for null before relying on the implicit alias to work. This kind of kills the utility of alias this. class A{} class B{ private A a; A foo(){ return a; } alias foo this; } void main(){ B b; A a = b; // seg fault assert(a is null); } --
May 03 2009
http://d.puremagic.com/issues/show_bug.cgi?id=2929 Lukasz Wrzosek <luk.wrzosek gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED CC| |luk.wrzosek gmail.com Resolution| |DUPLICATE PST --- *** This issue has been marked as a duplicate of issue 6777 *** -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Feb 14 2012
http://d.puremagic.com/issues/show_bug.cgi?id=2929 Lukasz Wrzosek <luk.wrzosek gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|RESOLVED |REOPENED Resolution|DUPLICATE | PST --- Sorry, it is not a duplicate ... :( -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Feb 14 2012
http://d.puremagic.com/issues/show_bug.cgi?id=2929 Andrej Mitrovic <andrej.mitrovich gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|REOPENED |RESOLVED CC| |andrej.mitrovich gmail.com Resolution| |INVALID 18:17:14 PST --- I don't understand this report. alias won't protect you from null references, keeping references non-null is the programmer's responsibility. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Feb 04 2013