Static constructors guaranteed to run?

Steven Schveighoffer via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Tue Jun 30 08:52:55 PDT 2015


On 6/26/15 6:00 PM, Tofu Ninja wrote:
> Also are static constructors in templated types guaranteed to run for
> every instantiation?

I'd hazard to guess that the current compiler does run them, but that 
they probably aren't guaranteed to run by a sufficiently smart future 
compiler.

Note, I strongly would discourage having static ctors inside templates:

https://issues.dlang.org/show_bug.cgi?id=14517

-Steve



More information about the Digitalmars-d-learn mailing list