www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 10647] New: AutoImplement should implement overridden member functions with 'override' attributes

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

           Summary: AutoImplement should implement overridden member
                    functions with 'override' attributes
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Phobos
        AssignedTo: nobody puremagic.com
        ReportedBy: ttanjo gmail.com


--- Comment #0 from Tomoya Tanjo <ttanjo gmail.com> 2013-07-15 07:05:36 PDT ---
The following code should be compiled with no error messages but it does not.

---
// It is like BlackHole but it also overrides non-virtual functions
string generateDoNothing(C, alias fun)()  property
{
    import std.traits;
    string stmt;

    static if (is(ReturnType!fun == void))
        stmt ~= "";
    else
    {
        string returnType = ReturnType!fun.stringof;
        stmt ~= "return "~returnType~".init;";
    }
    return stmt;
}

// A class to be overridden
class Foo{
    void bar(int a) { }
}

// Do nothing template
template DoNothing(Base)
{
    import std.typecons;
    alias DoNothing = AutoImplement!(Base, generateDoNothing, isAlwaysTrue);
}

template isAlwaysTrue(alias fun)
{
    enum isAlwaysTrue = true;
}

void main()
{
    auto foo = new DoNothing!Foo();
    foo.bar(13);
}
---

In dmd v2.064-devel-390a934 on Linux 64bit, it is compiled with the message
"Deprecation: overriding base class function without using override attribute
is deprecated".
The reason is that current AutoImplement implements overridden member functions
with 'override' attritubes only for the abstract functions.
It is the reason why WhiteHole and BlackHole work without depcerated messages.
They only override abstract functions.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Jul 15 2013
next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=10647


Kenji Hara <k.hara.pg gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |pull, rejects-valid


--- Comment #1 from Kenji Hara <k.hara.pg gmail.com> 2013-07-15 19:49:26 PDT ---
https://github.com/D-Programming-Language/phobos/pull/1416

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Jul 15 2013
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=10647



--- Comment #2 from Kenji Hara <k.hara.pg gmail.com> 2013-07-16 18:27:46 PDT ---
(In reply to comment #1)
 https://github.com/D-Programming-Language/phobos/pull/1416
More better Phobos change: https://github.com/D-Programming-Language/phobos/pull/1414 -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Jul 16 2013
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=10647



--- Comment #3 from github-bugzilla puremagic.com 2013-07-17 06:32:58 PDT ---
Commits pushed to master at https://github.com/D-Programming-Language/phobos

https://github.com/D-Programming-Language/phobos/commit/b92432cb7acb9c8a91b8d1b39f33595bac2d7953
Fix Issue 10647

https://github.com/D-Programming-Language/phobos/commit/30a67009e288b15f07a7c0bf6a98b6388e51f3a2
Merge branch 'master' into issue10647

https://github.com/D-Programming-Language/phobos/commit/d946bcd4ebf9b368063818286aa0a797fb6cbe86
Merge pull request #1414 from tom-tan/issue10647

Fix Issue 10647

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Jul 17 2013
prev sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=10647


Kenji Hara <k.hara.pg gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED


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