digitalmars.D.bugs - [Issue 5171] New: disable doesn't work on opEquals functions
- d-bugmail puremagic.com (32/32) Nov 05 2010 http://d.puremagic.com/issues/show_bug.cgi?id=5171
- d-bugmail puremagic.com (21/21) Nov 05 2010 http://d.puremagic.com/issues/show_bug.cgi?id=5171
- d-bugmail puremagic.com (12/14) Nov 05 2010 http://d.puremagic.com/issues/show_bug.cgi?id=5171
- d-bugmail puremagic.com (6/6) Nov 05 2010 http://d.puremagic.com/issues/show_bug.cgi?id=5171
- d-bugmail puremagic.com (44/44) Nov 09 2010 http://d.puremagic.com/issues/show_bug.cgi?id=5171
http://d.puremagic.com/issues/show_bug.cgi?id=5171 Summary: disable doesn't work on opEquals functions Product: D Version: D2 Platform: Other URL: http://www.digitalmars.com/d/2.0/attribute.html#disabl e OS/Version: Windows Status: NEW Severity: normal Priority: P2 Component: DMD AssignedTo: nobody puremagic.com ReportedBy: Jesse.K.Phillips+D gmail.com CC: Jesse.K.Phillips+D gmail.com 10:15:28 PDT --- When overriding a function of a base class disable does not cause compile time errors when called. class A { disable override equals_t opEquals(Object other) { return false; } } void main() { auto a = new A(); auto b = new A(); if(a == b) assert(0); } -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Nov 05 2010
http://d.puremagic.com/issues/show_bug.cgi?id=5171 Steven Schveighoffer <schveiguy yahoo.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED CC| |schveiguy yahoo.com Resolution| |INVALID 11:00:33 PDT --- This isn't actually possible. What I would suggest is the compiler failing to compile your class instead, because you can't disable a base function. If for example, you have a function like this: bool foo(Object o1, Object o2) {...} Then would it be safe to assume that you could pass both a and b to foo? If so, then isn't it possible for foo to call o1 == o2? And how could the compiler possibly statically disable this? I'm going to mark it as invalid, and if you think you'd rather have the behavior where disable doesn't compile on overridden functions, then you can reopen with that description. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Nov 05 2010
http://d.puremagic.com/issues/show_bug.cgi?id=5171 bearophile_hugs eml.cc changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |bearophile_hugs eml.ccThis isn't actually possible. What I would suggest is the compiler failing to compile your class instead, because you can't disable a base function.I agree. Where possible a good compiler has to statically disallow impossible code :-) -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Nov 05 2010
http://d.puremagic.com/issues/show_bug.cgi?id=5171 Added a note to bug 3934 -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Nov 05 2010
http://d.puremagic.com/issues/show_bug.cgi?id=5171 Jesse Phillips <Jesse.K.Phillips+D gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|RESOLVED |REOPENED Resolution|INVALID | Summary| disable doesn't work on |Prevent compiling of class |opEquals functions |when disable is used on an | |overriding function Severity|normal |enhancement 11:10:36 PST --- class A { void hello() { } } class B : A { disable override void hello() { } } void main() { auto a = new A(); A b = new B(); b.hello(); } The compiler should not compile the class saying something to the effect of: Can not disable method hello in base class A from B. Or another suggestion "Cannot disable overriding function hello in B" Note that I think the code below should still compile: class A { disable void hello() { } } class B : A { override void hello() { } } void main() { auto a = new A(); B b = new B(); b.hello(); } -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Nov 09 2010