[Issue 10168] New: Named tuple: inconsistent behavior

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sat May 25 18:07:06 PDT 2013


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

           Summary: Named tuple: inconsistent behavior
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Phobos
        AssignedTo: nobody at puremagic.com
        ReportedBy: r.97all at gmail.com


--- Comment #0 from Ryuichi OHORI <r.97all at gmail.com> 2013-05-25 18:07:05 PDT ---
The code at the bottom outputs
> S(314159265)
> S(0)
in DMD 2.062, http://dpaste.1azy.net/96d42b70
but
> S(0)
> S(314159265)
in another version, http://dpaste.1azy.net/edc065ea
I think right output is S(314159265) repeated 2 times.

-----
import std.stdio;
import std.typecons : Tuple;

struct S
{
    int x;
    Tuple!(S, "x") toTuple()
    {
        return Tuple!(S, "x")(this);
    }
}

void main()
{
    auto y = S(314159265).toTuple();
    y[0].writeln();
    y.x.writeln();
}

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