[Issue 11325] swap accepts aggregates with non-mutable fields
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Tue Oct 22 09:57:01 PDT 2013
http://d.puremagic.com/issues/show_bug.cgi?id=11325
--- Comment #2 from monarchdodra at gmail.com 2013-10-22 09:57:00 PDT ---
Are you on the *latest* head? It was partially introduced with my latest
non-assignable fix.
However, it was also a pre-existing case (albeit harder to hit), if the type
actually had an elaborate assign:
//----
struct S
{
void opAssign(S){}
const int i;
}
S s1 = S(0);
S s2 = S(1);
swap(s1, s2); //Clobbers i.
//----
This "correctly" bypasses the opAssign, clobering i.
The question is: do we want to cater to types that *have* an opAssign, but
can't be memory *moved*? Tough question imo.
Although I guess we could cater to that in a separate ER.
--
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
More information about the Digitalmars-d-bugs
mailing list