[Issue 12904] New: Wrong-code for some slice to slice assignments when using `opDollar`
via Digitalmars-d-bugs
digitalmars-d-bugs at puremagic.com
Fri Jun 13 00:32:42 PDT 2014
https://issues.dlang.org/show_bug.cgi?id=12904
Issue ID: 12904
Summary: Wrong-code for some slice to slice assignments when
using `opDollar`
Product: D
Version: D2
Hardware: All
OS: All
Status: NEW
Keywords: wrong-code
Severity: regression
Priority: P1
Component: DMD
Assignee: nobody at puremagic.com
Reporter: verylonglogin.reg at gmail.com
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.
--
More information about the Digitalmars-d-bugs
mailing list