[Issue 4632] New: Copy constructor not invoked on array reallocation
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Thu Aug 12 02:01:32 PDT 2010
http://d.puremagic.com/issues/show_bug.cgi?id=4632
Summary: Copy constructor not invoked on array reallocation
Product: D
Version: D2
Platform: All
OS/Version: All
Status: NEW
Severity: normal
Priority: P2
Component: druntime
AssignedTo: sean at invisibleduck.org
ReportedBy: rsinfu at gmail.com
--- Comment #0 from Shin Fujishiro <rsinfu at gmail.com> 2010-08-12 02:01:24 PDT ---
Struct copy constructor is not invoked on array copy, expansion nor
concatenation; but it should.
-------------------- array_cpctor.d
void main()
{
auto ss = new S[](1);
auto ssdup = ss.dup;
// A copy is created...
assert(&ss[0] != &ssdup[0]);
// but the copy constructor is not invoked!
assert(ssdup[0].copy); // Assertion failure
}
struct S
{
bool copy;
this(this) { copy = true; }
}
--------------------
% dmd -run array_cpctor.d
core.exception.AssertError at array_cpctor(10): Assertion failure
--------------------
--
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