Bug 8282 – Can not allocate an Array!T on heap.

Status
RESOLVED
Resolution
DUPLICATE
Severity
normal
Priority
P2
Component
phobos
Product
D
Version
D2
Platform
All
OS
All
Creation time
2012-06-22T05:10:00Z
Last change time
2014-02-12T22:52:54Z
Assigned to
nobody
Creator
tobias

Comments

Comment #0 by tobias — 2012-06-22T05:10:39Z
from the newsgroup: On Friday, 22 June 2012 at 10:19:13 UTC, Timon Gehr wrote: > On 06/22/2012 08:45 AM, Tobias Pankrath wrote: >> import std.container; >> >> struct A {}; >> >> void main() >> { >> Array!(A)* arr = new Array!(A); >> } >> >> yields >> >> >> bug.d(7): Error: template std.container.Array!(A).Array.__ctor >> does not >> match any function template declaration >> /usr/include/d/std/container.d(1625): Error: template >> std.container.Array!(A).Array.__ctor(U) if >> (isImplicitlyConvertible!(U,T)) cannot deduce template >> function from >> argument types !()() >> > > This seems to work: > > import std.container; > > struct A {}; > > void main() { > auto arr = new Array!A(A.init); > } I think it should work, though. Otherwise it should be made explicit in the documentation how to do this.
Comment #1 by monarchdodra — 2014-02-12T03:27:38Z
Fixed as bug 8763: https://d.puremagic.com/issues/show_bug.cgi?id=8763 *** This issue has been marked as a duplicate of issue 8763 ***
Comment #2 by github-bugzilla — 2014-02-12T22:52:54Z
Commit pushed to master at https://github.com/D-Programming-Language/phobos https://github.com/D-Programming-Language/phobos/commit/2b71a0bf5c828b1916673a8c0bbcdb1d01babf2b Merge pull request #1927 from Poita/bug8282 Regression Test 8282 - new Array!T