[Issue 6606] New: RefCounted doesn't work with unions due to use of format

d-bugmail at puremagic.com d-bugmail at puremagic.com
Mon Sep 5 17:24:11 PDT 2011


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

           Summary: RefCounted doesn't work with unions due to use of
                    format
           Product: D
           Version: D2
          Platform: Other
        OS/Version: Windows
            Status: NEW
          Severity: regression
          Priority: P2
         Component: Phobos
        AssignedTo: nobody at puremagic.com
        ReportedBy: dsimcha at yahoo.com


--- Comment #0 from David Simcha <dsimcha at yahoo.com> 2011-09-05 17:24:01 PDT ---
import std.typecons;

struct S {
    U u;
}

union U {
    size_t i;
    void* p;
}

alias RefCounted!(S) SRC;

C:\dmd2\windows\bin\..\..\src\phobos\std\format.d(1853): Error: static assert 
"unable to format union object because it does not have toString"
C:\dmd2\windows\bin\..\..\src\phobos\std\format.d(1982):        instantiated
from here: formatValue!(Appender!(string),U,char)
C:\dmd2\windows\bin\..\..\src\phobos\std\format.d(309):        instantiated
from here: formatGeneric!(Appender!(string),U,immutable(char))
C:\dmd2\windows\bin\..\..\src\phobos\std\typecons.d(511):        instantiated
from here: formattedWrite!(Appender!(string),immutable(char),U)
    ... (4 instantiations, -v to show) ...
C:\dmd2\windows\bin\..\..\src\phobos\std\typecons.d(2386):        instantiated
from here: Tuple!(S,"_payload",uint,"_count")
C:\code\test.d(12):        instantiated from here: RefCounted!(S)

-- 
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