Why is SysTime.init invalid?
ed
sillymongrel at gmail.com
Mon Mar 31 22:14:20 PDT 2014
Hi All,
I'm trying to use SysTime in a struct but I've noticed the
following:
(A) SysTime.init leads to a crash.
---
void main()
{
SysTime t;
writefln("t:%s", t);
}
% ./dtest
zsh: segmentation fault (core dumped) ./dtest
---
(B) Initialising a SysTime member directly fails
---
struct T
{
SysTime t=SysTime(0);
}
datetime.d (28538) Error: static variable _lowLock cannot be read
at compile time
---
Which means I have to provide a default ctor for my struct but do
not know how.
1. Is this by design or is it a bug?
2. Is there a way to provide a default struct ctor so I can init
the SysTime member?
If this is by design I don't think it should crash. A Date/Time
error is often something user code can safely recover from.
Thanks,
ed
More information about the Digitalmars-d-learn
mailing list