What does this compile-time error mean?

Timon Gehr timon.gehr at gmx.ch
Sun Feb 24 05:05:26 PST 2013


On 02/24/2013 01:59 PM, Maxim Fomin wrote:
> On Sunday, 24 February 2013 at 09:00:17 UTC, Jonathan M Davis wrote:
>> Because main_cont is module-level variable, it must be initialized with a
>> value at compile time. Classes can be used at compile time (at least
>> some of
>> the time), but they cannot stick around between compile time and runtime,
>> meaning that you could potentially use them in a CTFE function, but
>> you can't
>> initialize a module-level or static variable (or enum) with them, and
>> you're
>> attempting to initialize maint_cont with a RedBlackTree, which is a
>> class. It
>> won't work.
>>
>> - Jonathan M Davis
>
> I would say that it is arbitrary restriction
>...

Yes, IIRC Don once stated that it is a problem with DMD's architecture.



More information about the Digitalmars-d-learn mailing list