When trying to compile the following code I get a compilation
error
----
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!");
}
----
source/app.d(12,31): Error: cannot create instance of abstract
class MyInfo
source/app.d(12,31): function 'string nameImpl()' is not
implemented
If I move the info_ static variable declaration after the
nameImpl method declaration, there is no error anymore.
Is this normal ? What rule is in play here ? Or is this a
compiler bug ?