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

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sun Aug 18 23:32:21 PDT 2013


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


monarchdodra at gmail.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |monarchdodra at gmail.com


--- Comment #1 from monarchdodra at gmail.com 2013-08-18 23:32:20 PDT ---
(In reply to comment #0)
> -----
> 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.

This was specifically fixed in my "Rewrite [Un|Minimally]InitializedArray".
https://github.com/D-Programming-Language/phobos/pull/1447

Specifically, it will static assert with the message:
"Argument types in (ulong) are not all convertible to size_t: (ulong)"

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