[Issue 11325] New: swap accepts aggregates with non-mutable fields
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Tue Oct 22 09:40:31 PDT 2013
http://d.puremagic.com/issues/show_bug.cgi?id=11325
Summary: swap accepts aggregates with non-mutable fields
Product: D
Version: D2
Platform: All
OS/Version: All
Status: NEW
Keywords: accepts-invalid
Severity: normal
Priority: P2
Component: Phobos
AssignedTo: nobody at puremagic.com
ReportedBy: monarchdodra at gmail.com
--- Comment #0 from monarchdodra at gmail.com 2013-10-22 09:40:30 PDT ---
Which basically means it mutates the immutable:
unittest
{
struct S
{
const int i;
}
S s1 = S(0);
S s2 = S(1);
swap(s1, s2); //Clobbers i.
}
Swap being a trusted function, this is not acceptable.
https://github.com/D-Programming-Language/phobos/pull/1603
--
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