From fcc1aab7884bb460de8fce47a3a4ba5fd0e8d785 Mon Sep 17 00:00:00 2001 From: k-hara Date: Tue, 3 Mar 2015 00:01:50 +0900 Subject: [PATCH] fix Issue 14233 - Can't build Algebraic!(This[]) anymore In pull#2453, VariantN.opIndex has been changed to return `Variant`. It affects to OpID.catAssign case in handler(A), because it's using `alias E = typeof((*zis)[0]);` to determine concatenated element type. --- std/variant.d | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/std/variant.d b/std/variant.d index f0dbaef7d29..552041621ca 100644 --- a/std/variant.d +++ b/std/variant.d @@ -481,7 +481,7 @@ private: static if (!is(Unqual!(typeof((*zis)[0])) == void) && is(typeof((*zis)[0])) && is(typeof((*zis) ~= *zis))) { // array type; parm is the element to append - auto arg = cast(VariantN*) parm; + auto arg = cast(Variant*) parm; alias E = typeof((*zis)[0]); if (arg[0].convertsTo!(E)) { @@ -1107,7 +1107,7 @@ public: ///ditto VariantN opCatAssign(T)(T rhs) { - auto toAppend = VariantN(rhs); + auto toAppend = Variant(rhs); fptr(OpID.catAssign, &store, &toAppend) == 0 || assert(false); return this; } @@ -1299,6 +1299,15 @@ unittest assert(aa["b"] == 3); } +// Issue #14233 +unittest +{ + alias Atom = Algebraic!(string, This[]); + + Atom[] values = []; + auto a = Atom(values); +} + pure nothrow @nogc unittest {