Bug 12904 – Wrong-code for some slice to slice assignments when using `opDollar`
Status
RESOLVED
Resolution
FIXED
Severity
regression
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2014-06-13T07:32:00Z
Last change time
2014-06-15T20:43:18Z
Keywords
pull, wrong-code
Assigned to
nobody
Creator
verylonglogin.reg
Comments
Comment #0 by verylonglogin.reg — 2014-06-13T07:32:42Z
This code should run fine:
---
struct S
{
size_t opDollar(size_t dim)() // never called but should
{ return 7; }
int opSlice(size_t dim)(size_t, size_t to)
{
assert(to == 7); // fails
return 1;
}
int opIndex(int, int)
{
return 1;
}
void opSliceAssign(int)
{ }
// This functions existence prevents `opDollar` from being called:
void opIndexAssign(U, A...)(U value, A args)
{
static assert(0);
}
}
void main()
{
S s;
// `s[0..$, 0..$]` causes ICE Issue 12902
s[] = s[0..$, 1];
}
---
Probably has the same root as Issue 12902.