www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 3676] New: shared function override

reply d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=3676

           Summary: shared function override
           Product: D
           Version: 2.038
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody puremagic.com
        ReportedBy: repeatedly gmail.com



06:26:07 PST ---
class Sample
{
    void method() {}
    shared void method() {}
}

class Sample2 : Sample
{
    override void method() {}
    override shared void method() {} // Line 10
}

2.037 succeeds in compiling this code, but 2.038 and 2.039 fail.
2.039 outputs following error message:

 foo.d(10): Error: function foo.Sample2.method of type shared void()
 overrides but is not covariant with foo.Sample2.method of type void()

For that matter, following code is minimum sample which same error occurs.

class Sample
{
    void method() {}
}

class Sample2 : Sample
{
    shared void method() {}
}

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Jan 05 2010
parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=3676


Walter Bright <bugzilla digitalmars.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |bugzilla digitalmars.com
         Resolution|                            |WORKSFORME



23:03:43 PST ---
The first example compiles correctly with dmd 2.041.

The second example correctly fails, because shared cannot override an unshared
method.

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