Bug 8457 – Disabled default constructors have no effect when used in arrays

Status
RESOLVED
Resolution
DUPLICATE
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2012-07-27T17:16:00Z
Last change time
2012-07-27T17:30:18Z
Assigned to
nobody
Creator
simen.kjaras

Comments

Comment #0 by simen.kjaras — 2012-07-27T17:16:40Z
As discussed many moons ago, here: http://forum.dlang.org/thread/[email protected]?page=3#post-op.v01l4tgq1hx7vj:40biotronic-pc.lan struct S { @disable this(); } void main( ) { S[] a; a.length = 4; } The above code should not compile. Changing the length of an array like that (actually decreasing would be ok) should be a compile-time error, as those new elements cannot be properly constructed.
Comment #1 by issues.dlang — 2012-07-27T17:24:22Z
More like @disable this(); is completely broken for structs: bug# 7021
Comment #2 by simen.kjaras — 2012-07-27T17:28:51Z
(In reply to comment #1) > More like @disable this(); is completely broken for structs: bug# 7021 Indeed. Perhaps these two should be merged. I thought of them as two separate issues, but see now that might not be the case.
Comment #3 by issues.dlang — 2012-07-27T17:30:18Z
*** This issue has been marked as a duplicate of issue 7021 ***