www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 9580] New: std.variant.Algebraic with Tuple format problem

reply d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=9580

           Summary: std.variant.Algebraic with Tuple format problem
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Keywords: rejects-valid
          Severity: normal
          Priority: P2
         Component: Phobos
        AssignedTo: nobody puremagic.com
        ReportedBy: bearophile_hugs eml.cc



import std.variant: Algebraic, This;
import std.typecons: Tuple;
alias Foo = Algebraic!(int, Tuple!(This[]));
void main() {
    auto f = Foo(0);
}


DMD 2.063alpha gives:

...\dmd2\src\phobos\std\format.d(1821): Error: static assert 
(isInputRange!(This[])) is false
...\dmd2\src\phobos\std\format.d(2279):        instantiated from here:
formatValue!(Appender!(string), This[], char)
...\dmd2\src\phobos\std\typecons.d(551):        instantiated from here:
formatElement!(Appender!(string), This[], char)
temp.d(3):        instantiated from here: Tuple!(This[])

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Feb 23 2013
parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=9580


Andrei Alexandrescu <andrei erdani.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |andrei erdani.com



PST ---
I'm on the road now but a quick test suggests that simply providing an empty
definition for This fixes the problem:

    struct This {}

Can someone give it a shot?

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