D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 6746 - static this() inside struct skipped upon static method call
Summary: static this() inside struct skipped upon static method call
Status: RESOLVED FIXED
Alias: None
Product: D
Classification: Unclassified
Component: dmd (show other issues)
Version: D2
Hardware: Other Mac OS X
: P2 normal
Assignee: No Owner
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-09-30 09:40 UTC by Andrei Alexandrescu
Modified: 2015-06-09 05:14 UTC (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description Andrei Alexandrescu 2011-09-30 09:40:03 UTC
A good example is given by core.time itself. Consider.

import core.time;

static this() {
    auto t = TickDuration.from!"msecs"(100);
}

void main(){}

This code aborts with a division by zero error. Apparently the call to the static method TickDuration.from is allowed without the @trusted shared static this() being called.