You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The rewrites for unary operator before a slice expression reject valid code.
Only the part tagged with "For backward compatibility" properly compiles.
struct S
{
static struct Slice { size_t l, u; }
Slice opSlice(size_t l, size_t u) { return Slice(l, u); }
S opIndexUnary(string op)(Slice slice)
{
return S.init;
}
}
unittest
{
S a;
S b = ++a[1 .. 2]; // fails
S c = a.opIndexUnary!("++")(a.opSlice(i, j));
}
The text was updated successfully, but these errors were encountered:
Bolpat reported this on 2019-05-24T15:28:45Z
Transferred from https://issues.dlang.org/show_bug.cgi?id=19900
Description
The rewrites for unary operator before a slice expression reject valid code. Only the part tagged with "For backward compatibility" properly compiles. struct S { static struct Slice { size_t l, u; } Slice opSlice(size_t l, size_t u) { return Slice(l, u); } S opIndexUnary(string op)(Slice slice) { return S.init; } } unittest { S a; S b = ++a[1 .. 2]; // fails S c = a.opIndexUnary!("++")(a.opSlice(i, j)); }The text was updated successfully, but these errors were encountered: