[Issue 10847] New: uninitializedArray accepts arguments which make it fail internally

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sun Aug 18 17:14:14 PDT 2013


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

           Summary: uninitializedArray accepts arguments which make it
                    fail internally
           Product: D
           Version: unspecified
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Phobos
        AssignedTo: nobody at puremagic.com
        ReportedBy: andrej.mitrovich at gmail.com


--- Comment #0 from Andrej Mitrovic <andrej.mitrovich at gmail.com> 2013-08-18 17:14:13 PDT ---
-----
import std.array;

void main()
{
    ubyte[] source = uninitializedArray!(ubyte[])(ulong.init);
}
-----

$ dmd test.d

C:\DMD\dmd2\windows\bin\..\..\src\phobos\std\array.d(321): Error: function
core.memory.GC.malloc (uint sz, uint ba = 0u) is not callable using argument
types (ulong, BlkAttr)
C:\DMD\dmd2\windows\bin\..\..\src\phobos\std\array.d(272): Error: template
instance std.array.arrayAllocImpl!(false, ubyte[], ulong) error instantiating
test.d(7):        instantiated from here: uninitializedArray!(ubyte[], ulong)
test.d(7): Error: template instance std.array.uninitializedArray!(ubyte[],
ulong) error instantiating

The constraint should disallow the argument instead of failing inside of Phobos
when instantiating other templates.

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