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

           Summary: instantiation of std.conv.toImpl and
                    std.format.formatValue fails for unions
           Product: D
           Version: D2
          Platform: x86
        OS/Version: Windows
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Phobos
        AssignedTo: nob...@puremagic.com
        ReportedBy: elfy...@gmail.com


--- Comment #0 from Nick Voronin <elfy...@gmail.com> 2010-12-12 19:07:13 PST ---
import std.conv;
import std.format;
import std.stdio;

union U
{
    int a;
    float b;
}

struct S
{
    int t;
    U u;
}

void main()
{
    U u;
    writeln(text(u)); // error instantiation toImpl
    S s;
    writeln(text(s)); // error instantiation formatValue
}

patching templates in this manner:
-if (is(S == struct) && ...
+if ((is(S == struct) || is(S == union)) && ...
fixes it for me.

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

Reply via email to