[Issue 10690] Assertion failure in swap caused by array() of a filter() of tuples of string

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sun Jul 21 23:54:07 PDT 2013


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


monarchdodra at gmail.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |monarchdodra at gmail.com


--- Comment #1 from monarchdodra at gmail.com 2013-07-21 23:54:05 PDT ---
(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:
> 
> core.exception.AssertError at std.algorithm(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.

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