Thread overview
[Issue 4855] New: When a class has private override member function, the function requires no return value type
Sep 12, 2010
Haruki Shigemori
Sep 12, 2010
Haruki Shigemori
Sep 13, 2010
Don
Jan 30, 2012
yebblies
September 12, 2010
http://d.puremagic.com/issues/show_bug.cgi?id=4855

           Summary: When a class has private override member function, the
                    function requires no return value type
           Product: D
           Version: D2
          Platform: Other
        OS/Version: Windows
            Status: NEW
          Keywords: accepts-invalid
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody@puremagic.com
        ReportedBy: rayerd.wiz@gmail.com


--- Comment #0 from Haruki Shigemori <rayerd.wiz@gmail.com> 2010-09-12 07:09:36 PDT ---
import std.stdio;
class Base
{
        int f() {return 0;}
}
class Derived : Base
{
        private override /+int+/ f() {return 1;} // accepts-invalid
}

void main()
{
}

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
September 12, 2010
http://d.puremagic.com/issues/show_bug.cgi?id=4855


bearophile_hugs@eml.cc changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |bearophile_hugs@eml.cc


--- Comment #1 from bearophile_hugs@eml.cc 2010-09-12 07:59:36 PDT ---
I agree this looks a bit strange, and it may even lead to a few bugs, but here DMD is acting as designed, so it's not a true bug.

When you use enum, override and few other things, DMD performs type inference, so the explicit return type is not necessary.

So I presume this bug may be closed.

(If you think this D characteristic is leads to many bugs then this bug report may be kept open, despite the probability of seeing it fixed is low.)

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
September 12, 2010
http://d.puremagic.com/issues/show_bug.cgi?id=4855



--- Comment #2 from Haruki Shigemori <rayerd.wiz@gmail.com> 2010-09-12 09:55:48 PDT ---
Thank you for your reply.
If this characteristic is a design of DMD, I will close this bug report.
What do you think that both look like asymmetry?

import std.stdio;
class Base
{
    int f() {return 0;}
    int g() {return 0;}
}
class Derived : Base
{
    private override /+int+/ f() {return 1;} // accepts
    public  override /+int+/ g() {return 1;} // rejects
}
void main() {}

main.d(10): Error: function main.Derived.g of type () overrides but is not
covariant with main.Base.g of type int()
main.d(10): Error: function main.Derived.g does not override any function

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
September 12, 2010
http://d.puremagic.com/issues/show_bug.cgi?id=4855



--- Comment #3 from bearophile_hugs@eml.cc 2010-09-12 11:14:20 PDT ---
I don't know what's going on, but I suggest to keep this bug report open.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
September 13, 2010
http://d.puremagic.com/issues/show_bug.cgi?id=4855


Don <clugdbug@yahoo.com.au> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |clugdbug@yahoo.com.au


--- Comment #4 from Don <clugdbug@yahoo.com.au> 2010-09-12 19:05:39 PDT ---
I think this is a duplicate of bug 3581.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
January 30, 2012
http://d.puremagic.com/issues/show_bug.cgi?id=4855


yebblies <yebblies@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |yebblies@gmail.com
         Resolution|                            |DUPLICATE


--- Comment #5 from yebblies <yebblies@gmail.com> 2012-01-30 16:53:57 EST ---
*** This issue has been marked as a duplicate of issue 3581 ***

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------