[Issue 8282] New: Can not allocate an Array!T on heap.

d-bugmail at puremagic.com d-bugmail at puremagic.com
Fri Jun 22 05:08:19 PDT 2012


http://d.puremagic.com/issues/show_bug.cgi?id=8282

           Summary: Can not allocate an Array!T on heap.
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Phobos
        AssignedTo: nobody at puremagic.com
        ReportedBy: tobias at pankrath.net


--- Comment #0 from Tobias Pankrath <tobias at pankrath.net> 2012-06-22 05:10:39 PDT ---
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.

-- 
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