www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 6901] New: wrong error "override cannot be applied to variable" in CTFE forward reference

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

           Summary: wrong error "override cannot be applied to variable"
                    in CTFE forward reference
           Product: D
           Version: D1 & D2
          Platform: Other
        OS/Version: Windows
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody puremagic.com
        ReportedBy: clugdbug yahoo.com.au



Applies to both D1 and D2, at least as far back as 2.040. It's a forward
reference error, triggered in this case by CTFE.

------------
class Base6900
{
    void foo() {}
}

class Derived6900: Base6900
{
    override void foo() { }
}

int test6900()
{
    Derived6900 d = new Derived6900;  // for github HEAD
    // Derived6900 d = null;   // for older versions
    d.foo();
    return 1;
}

static assert(test6900());
------------
test.d(8): Error: variable test.Derived6900.foo.this override cannot be applied
to variable
test.d(15):        called from here: d.foo()
test.d(19):        called from here: test6900()
test.d(19): Error: static assert  (test6900()) is not evaluatable at compile
tim
e

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Nov 07 2011
parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=6901


Walter Bright <bugzilla digitalmars.com> changed:

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



23:09:24 PST ---
https://github.com/D-Programming-Language/dmd/commit/366a1d759ed45d2aa4bfcb431a0d1ded1f8cf0fc

https://github.com/D-Programming-Language/dmd/commit/a25c281637a5cfdfad7eb55487ebfffca8bd49df

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