[Issue 6113] New: singletons in std.datetime are not created early enough

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sun Jun 5 22:28:56 PDT 2011


http://d.puremagic.com/issues/show_bug.cgi?id=6113

           Summary: singletons in std.datetime are not created early
                    enough
           Product: D
           Version: D2
          Platform: Other
        OS/Version: Windows
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Phobos
        AssignedTo: nobody at puremagic.com
        ReportedBy: jsancio at gmail.com


--- Comment #0 from Jose Garcia <jsancio at gmail.com> 2011-06-05 22:24:28 PDT ---
When accessing the singletons from a shared static this module ctr, the
singleton have not been instantiated. The following code succeeds when it
shouldn't:

import std.datetime;

shared static this()
{
  assert(UTC() is null);
  assert(LocalTime() is null);
}

A possible solution is:

class Test
{
   shared static this() { _obj = new immutable(shared(Object)); }
   shared static immutable Object _ojb;
}

shared static this()
{
   assert(Test._ojb !is null);
}

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list