[Issue 19900] New: Rewrites for unary index operator not done per the spec
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Fri May 24 15:28:45 UTC 2019
https://issues.dlang.org/show_bug.cgi?id=19900
Issue ID: 19900
Summary: Rewrites for unary index operator not done per the
spec
Product: D
Version: D2
Hardware: All
OS: All
Status: NEW
Severity: normal
Priority: P1
Component: dmd
Assignee: nobody at puremagic.com
Reporter: qs.il.paperinik at gmail.com
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));
}
--
More information about the Digitalmars-d-bugs
mailing list