www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 5387] New: Unclear error message "override cannot be applied to variable"

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

           Summary: Unclear error message "override cannot be applied to
                    variable"
           Product: D
           Version: D2
          Platform: Other
        OS/Version: Linux
            Status: NEW
          Severity: minor
          Priority: P4
         Component: DMD
        AssignedTo: nobody puremagic.com
        ReportedBy: acehreli yahoo.com


--- Comment #0 from Ali Cehreli <acehreli yahoo.com> 2010-12-28 13:41:38 PST ---
It is not easy to see that the dmd error message in the subject line probably
means something like "member function templates cannot be virtual." (Or after
the language of the spec page, "Templates cannot be used to add virtual
functions to classes.")

class Derived
{
    override void foo(T)()
    {}
}

void main()
{
    auto d = new Derived();
    d.foo!int();
}

Abreviated lines from dmd 2.051 output:

... Error: variable deneme.Derived.foo!(int).foo.this override cannot be
applied to variable
... Error: template instance deneme.Derived.foo!(int) error instantiating

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


Walter Bright <bugzilla digitalmars.com> changed:

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


--- Comment #1 from Walter Bright <bugzilla digitalmars.com> 2012-01-20
14:16:08 PST ---
The error message is now:

foo.d(3): Error: function foo.Derived.foo!(int).foo cannot override a
non-virtual function

which I think is adequate.

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