digitalmars.D.bugs - [Issue 1570] New: Wrong return for address operator
- d-bugmail puremagic.com Oct 11 2007
- d-bugmail puremagic.com Nov 08 2007
- d-bugmail puremagic.com Sep 09 2008
- d-bugmail puremagic.com Sep 09 2008
http://d.puremagic.com/issues/show_bug.cgi?id=1570 Summary: Wrong return for address operator Product: D Version: 2.005 Platform: PC OS/Version: Windows Status: NEW Severity: normal Priority: P2 Component: DMD AssignedTo: bugzilla digitalmars.com ReportedBy: PetSerAl gmail.com import std.stdio; void main() { b v=new b; v.f; v.a.f; (&v.f)(); (&v.a.f)(); } class a { void f() { writeln("class a"); } } class b:a { void f() { writeln("class b"); } } This program write: class b class a class b class b --
Oct 11 2007
http://d.puremagic.com/issues/show_bug.cgi?id=1570 smjg iname.com changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |smjg iname.com ------- Comment #1 from smjg iname.com 2007-11-08 08:04 ------- What is v.a and where's it documented? Should it work? --
Nov 08 2007
http://d.puremagic.com/issues/show_bug.cgi?id=1570 smjg iname.com changed: What |Removed |Added ---------------------------------------------------------------------------- Keywords| |accepts-invalid, wrong-code ------- Comment #2 from smjg iname.com 2008-09-09 14:56 ------- Since I can't at the moment find any evidence in the spec that v.a is a valid expression, I'm marking this as accepts-invalid. If I'm wrong, please show me where it's defined. --
Sep 09 2008
http://d.puremagic.com/issues/show_bug.cgi?id=1570 ------- Comment #3 from jarrett.billingsley gmail.com 2008-09-09 15:17 ------- (In reply to comment #2)Since I can't at the moment find any evidence in the spec that v.a is a valid expression, I'm marking this as accepts-invalid. If I'm wrong, please show me where it's defined.
a is the class a, which for some reason is accessible through a reference to class b. If you capitalize the class names it makes it a lot clearer. I think it might actually be somehow related to the thing about typeof(this) and non-virtual calls made on the expressions page: http://www.digitalmars.com/d/1.0/expression.html In any case it doesn't seem to be explicitly documented, but I wonder if there's a use for it. It breaks encapsulation by allowing you to manually access a base class's implementation of a method, and with single inheritance there's no need to select the implementation from several base classes. --
Sep 09 2008









d-bugmail puremagic.com 