(In reply to comment #0)
> import std.algorithm: filter;
> import std.array: array;
> import std.typecons: tuple;
> void main() {
> [tuple(1)].filter!(t => true).array; // No error
> [tuple("A")].filter!(t => true).array; // error
> }
>
>
> DMD 2.064alpha gives me:
>
> [email protected](1923): Assertion failure
This looks like a combination of:
http://d.puremagic.com/issues/show_bug.cgi?id=9824
Basically, emplace is calling opAssign over a garbage struct. This leads to undefined bahavior, since the implementation of Tupple's opAssign assume the current Tuple to be in a known state (to use the "swap-and-destroy" strategy)
And bug http://d.puremagic.com/issues/show_bug.cgi?id=9975
Where, arguably, swap has no business making that assertion.
This should spontaneously resolve itself once either of these two bugs are fixed.
Comment #2 by bearophile_hugs — 2013-07-22T04:56:43Z
(In reply to comment #1)
> This should spontaneously resolve itself once either of these two bugs are
> fixed.
OK. In the meantime this regression is breaking a good amount of my code.
Comment #3 by monarchdodra — 2013-07-22T23:03:18Z
(In reply to comment #2)
> (In reply to comment #1)
>
> > This should spontaneously resolve itself once either of these two bugs are
> > fixed.
>
> OK. In the meantime this regression is breaking a good amount of my code.
I was curious about what happened, since these are old outstanding bugs. The regression itself was introduced by the correct "swap and destroy" introduced in tuple here:
https://github.com/D-Programming-Language/phobos/commit/d8c6187d6e94ed794382e4b21b7876085cb523b2#std/typecons.d
Comment #4 by code — 2013-08-28T01:45:39Z
The emplace changes from issue 9824 are in, but the problem still occurs in Git master.
Comment #5 by monarchdodra — 2013-08-28T02:02:45Z
(In reply to comment #4)
> The emplace changes from issue 9824 are in, but the problem still occurs in Git
> master.
Problem is actually in Appender now: Kenji's safe/pure appender isn't using emplace.
Comment #6 by monarchdodra — 2013-08-28T04:29:47Z
(In reply to comment #5)
> (In reply to comment #4)
> > The emplace changes from issue 9824 are in, but the problem still occurs in Git
> > master.
>
> Problem is actually in Appender now: Kenji's safe/pure appender isn't using
> emplace.
https://github.com/D-Programming-Language/phobos/pull/1529
Apologies to Kenji, the bug was pre-existing.
Comment #7 by verylonglogin.reg — 2013-09-30T07:19:59Z
*** Issue 10859 has been marked as a duplicate of this issue. ***
Comment #8 by monarchdodra — 2013-11-07T23:20:01Z
*** Issue 11474 has been marked as a duplicate of this issue. ***
Comment #9 by sludwig — 2014-06-25T07:34:50Z
*** Issue 11357 has been marked as a duplicate of this issue. ***