Thread overview
[Issue 6606] New: RefCounted doesn't work with unions due to use of format
Sep 06, 2011
David Simcha
Sep 06, 2011
David Simcha
Sep 06, 2011
klickverbot
Sep 06, 2011
David Simcha
Sep 06, 2011
Kenji Hara
Sep 06, 2011
Jonathan M Davis
September 06, 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@puremagic.com
        ReportedBy: dsimcha@yahoo.com


--- Comment #0 from David Simcha <dsimcha@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: -------
September 06, 2011
http://d.puremagic.com/issues/show_bug.cgi?id=6606



--- Comment #1 from David Simcha <dsimcha@yahoo.com> 2011-09-05 17:36:26 PDT ---
Actually, it's a problem with Tuple or format, depending on how you look at it.
 This doesn't work either, for basically the same reason:

import std.typecons;

union U {
    size_t i;
    void* p;
}

alias Tuple!U T;

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
September 06, 2011
http://d.puremagic.com/issues/show_bug.cgi?id=6606


klickverbot <code@klickverbot.at> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |code@klickverbot.at


--- Comment #2 from klickverbot <code@klickverbot.at> 2011-09-05 19:19:33 PDT ---
When did this first appear? 2.055 beta? Probably related to https://github.com/D-Programming-Language/phobos/pull/126.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
September 06, 2011
http://d.puremagic.com/issues/show_bug.cgi?id=6606



--- Comment #3 from David Simcha <dsimcha@yahoo.com> 2011-09-05 19:23:22 PDT ---
(In reply to comment #2)
> When did this first appear? 2.055 beta? Probably related to https://github.com/D-Programming-Language/phobos/pull/126.

Yes, in the second 2.055 beta.  It probably is related to the pull you suggest, because it wasn't in the first beta, but it was in the second.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
September 06, 2011
http://d.puremagic.com/issues/show_bug.cgi?id=6606


Kenji Hara <k.hara.pg@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |patch


--- Comment #4 from Kenji Hara <k.hara.pg@gmail.com> 2011-09-06 00:04:34 PDT ---
https://github.com/D-Programming-Language/phobos/pull/242

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
September 06, 2011
http://d.puremagic.com/issues/show_bug.cgi?id=6606


Jonathan M Davis <jmdavisProg@gmx.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |jmdavisProg@gmx.com
         Resolution|                            |FIXED


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