Bug 10968 – array element copy (1-N and N-N) ignores postblit attributes
Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2013-09-05T01:44:00Z
Last change time
2013-09-08T02:45:37Z
Keywords
accepts-invalid, pull
Assigned to
nobody
Creator
monarchdodra
Comments
Comment #0 by monarchdodra — 2013-09-05T01:44:28Z
For either static or dynamic
//----
struct S
{
this(this) @disable;
}
void main()
{
S s;
S[1] ss = s; //Passes, should fail
ss = s; //Passes, should fail
ss[] = s; //Passes, should fail
ss = ss; //Correctly fails
ss[] = ss[]; //Correctly fails
S s2 = s; //Correctly fails
}
Comment #1 by k.hara.pg — 2013-09-05T02:29:48Z
@safe/pure/nothrow attributes also be ignored wrongly.
struct SA
{
this(this)
{
throw new Exception("BOOM!");
}
}
void main() pure @safe nothrow
{
SA ss;
SA[1] sa;
// TOKassign
ss = ss; // correctly fails
sa = ss; // no error
sa = sa; // no error
// TOKconstruct
SA ss2 = ss; // correctly fails
SA[1] sa2 = ss; // no error
SA[1] sa3 = sa; // no error
}