Static constructors guaranteed to run?

via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Sun Jun 28 02:34:29 PDT 2015


On Saturday, 27 June 2015 at 20:16:10 UTC, Timon Gehr wrote:
> On 06/27/2015 11:54 AM, "Marc =?UTF-8?B?U2Now7x0eiI=?= 
> <schuetzm at gmx.net>" wrote:
>>
>>
>>> Also are static constructors in templated types guaranteed to 
>>> run for
>>> every instantiation? Even if the instantiation is never 
>>> actually used
>>> outside of compile time code, like in an alias or in a UDA?
>>
>> Definitely not. Things inside a template don't even exist if 
>> that
>> template is never instantiated.
>
> (That wasn't his question.)

Ah sorry, I see. In this case I don't know the answer. There 
might even be a difference between normal CTFE code and 
is-expressions...


More information about the Digitalmars-d-learn mailing list