Is this a bug in std.typecons.Tuple.slice?

Marco Leise via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Thu Feb 4 09:38:00 PST 2016


Am Thu, 04 Feb 2016 15:17:54 +0000
schrieb Saurabh Das <saurabh.das at gmail.com>:

> On Thursday, 4 February 2016 at 12:28:39 UTC, Saurabh Das wrote:
> > This code:
> > [...]
> 
> Update: Simplified, this also doesn't work:
> 
> void main()
> {
>      import std.typecons;
>      auto tp = tuple(10, false, "hello");
> 
>      auto u0 = tp.slice!(0, tp.length);
>      auto u1 = tp.slice!(1, tp.length);
>      auto u2 = tp.slice!(2, tp.length);
> 
>      static assert(is(typeof(u0) == Tuple!(int, bool, string)));
>      static assert(is(typeof(u1) == Tuple!(bool, string)));
>      static assert(is(typeof(u2) == Tuple!(string)));
> 
>      assert(u2[0] == "hello");
>      assert(u0[2] == "hello");
>      assert(u1[1] == "hello");    // This fails
> }
> 
> rdmd erasetype.d
> core.exception.AssertError at erasetype.d(16): Assertion failure
> 
> Any ideas?

Yes this is a clear bug, I'll report a bug and post the issue
number later.

-- 
Marco



More information about the Digitalmars-d-learn mailing list