Overriden method not detected ?
Steven Schveighoffer via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Fri Jun 3 05:36:03 PDT 2016
On 6/3/16 8:03 AM, chmike wrote:
> import std.stdio;
>
> class Info
> {
> final string name() { return nameImpl(); }
> protected abstract string nameImpl();
> }
>
> final class MyInfo : Info
> {
> this() { assert(__ctfe); }
> private __gshared info_ = new MyInfo; // Line 12
>
> static string name() { return "MyInfo"; }
> protected override string nameImpl() { return name(); }
> }
>
> void main()
> {
> writeln("Hello world!");
> }
Yes, this is a forward reference bug.
Move the info_ member to the end of the class and it compiles.
Please file https://issues.dlang.org
-Steve
More information about the Digitalmars-d-learn
mailing list