[Issue 6901] New: wrong error "override cannot be applied to variable" in CTFE forward reference

d-bugmail at puremagic.com d-bugmail at puremagic.com
Mon Nov 7 01:25:02 PST 2011


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 at puremagic.com
        ReportedBy: clugdbug at yahoo.com.au


--- Comment #0 from Don <clugdbug at yahoo.com.au> 2011-11-07 01:24:26 PST ---
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: -------


More information about the Digitalmars-d-bugs mailing list