Error instantiating std.container.Array
I'm trying to instantiate a std.container.Array of a given class (named Material), by a simple Array!Material _myStuff; I get two compile errors stating the following: C:\D\dmd2\windows\bin\..\..\src\phobos\std\container\array.d(85): Error: template std.algorithm.initializeAll cannot deduce function from argument types !()(Material[]), candidates are: C:\D\dmd2\windows\bin\..\..\src\phobos\std\algorithm.d(1502): std.algorithm.initializeAll(Range)(Range range) if (isInputRange!Range hasLvalueElements!Range hasAssignableElements!Range) C:\D\dmd2\windows\bin\..\..\src\phobos\std\algorithm.d(1530): std.algorithm.initializeAll(Range)(Range range) if (is(Range == char[]) || is(Range == wchar[])) C:\D\dmd2\windows\bin\..\..\src\phobos\std\container\array.d(825): Error: template std.algorithm.copy cannot deduce function from argument types !()(Range, Range), candidates are: C:\D\dmd2\windows\bin\..\..\src\phobos\std\algorithm.d(7808): std.algorithm.copy(Range1, Range2)(Range1 source, Range2 target) if (isInputRange!Range1 isOutputRange!(Range2, ElementType!Range1)) Any idea about what might be happening? I can't give a quick minimal example of the code since it is quite complex (and I failed at using dustmite trying to minimize it)
Re: Error instantiating std.container.Array
I'm really clueless... :P Something is wrong with your Material class, but you'll need to show us a reduced example.
Re: Error instantiating std.container.Array
On Monday, 2 March 2015 at 14:08:29 UTC, Francesco Cattoglio wrote: I'm trying to instantiate a std.container.Array of a given class (named Material), by a simple Array!Material _myStuff; I get two compile errors stating the following: C:\D\dmd2\windows\bin\..\..\src\phobos\std\container\array.d(85): Error: template std.algorithm.initializeAll cannot deduce function from argument types !()(Material[]), candidates are: C:\D\dmd2\windows\bin\..\..\src\phobos\std\algorithm.d(1502): std.algorithm.initializeAll(Range)(Range range) if (isInputRange!Range hasLvalueElements!Range hasAssignableElements!Range) C:\D\dmd2\windows\bin\..\..\src\phobos\std\algorithm.d(1530): std.algorithm.initializeAll(Range)(Range range) if (is(Range == char[]) || is(Range == wchar[])) C:\D\dmd2\windows\bin\..\..\src\phobos\std\container\array.d(825): Error: template std.algorithm.copy cannot deduce function from argument types !()(Range, Range), candidates are: C:\D\dmd2\windows\bin\..\..\src\phobos\std\algorithm.d(7808): std.algorithm.copy(Range1, Range2)(Range1 source, Range2 target) if (isInputRange!Range1 isOutputRange!(Range2, ElementType!Range1)) Any idea about what might be happening? I can't give a quick minimal example of the code since it is quite complex (and I failed at using dustmite trying to minimize it) Try to reduce your Material class for a small failing example. It's probably your constructors or opAssign or something like that. Anyway, it's a bug if template errors from the implementation bubble up, so please file a report.
Re: Error instantiating std.container.Array
On Monday, 2 March 2015 at 14:46:31 UTC, ketmar wrote: On Mon, 02 Mar 2015 14:40:50 +, Francesco Cattoglio wrote: did you tried to dustmite[1] it? [1] https://github.com/CyberShadow/DustMite/wiki I tried to dub dustmite, but it failed with a object.Exception@DustMite\dustmite.d(220): Initial test fails The dustmite version is the one that was bundled with dmd 2.066.1-rc2. I'll update dmd in the mean time, but I have a feeling that this is not related.
Re: Error instantiating std.container.Array
On Mon, 02 Mar 2015 14:40:50 +, Francesco Cattoglio wrote: did you tried to dustmite[1] it? [1] https://github.com/CyberShadow/DustMite/wiki signature.asc Description: PGP signature
Re: Error instantiating std.container.Array
On Monday, 2 March 2015 at 15:01:55 UTC, Tobias Pankrath wrote: I'm really clueless... :P Something is wrong with your Material class, but you'll need to show us a reduced example. After a really long time I finally found what was wrong. http://dpaste.dzfl.pl/16d202b7124d Wow, I honestly could have NEVER foreseen this. This is all it takes for a class being unusable in a std.container.Array class MyClass { void init(); }
Re: Error instantiating std.container.Array
On Monday, 2 March 2015 at 15:14:49 UTC, Francesco Cattoglio wrote: On Monday, 2 March 2015 at 15:01:55 UTC, Tobias Pankrath wrote: I'm really clueless... :P Something is wrong with your Material class, but you'll need to show us a reduced example. After a really long time I finally found what was wrong. http://dpaste.dzfl.pl/16d202b7124d Wow, I honestly could have NEVER foreseen this. This is all it takes for a class being unusable in a std.container.Array class MyClass { void init(); } .init is a special property of every type: http://dlang.org/property.html#init
Re: Error instantiating std.container.Array
On 03/02/2015 07:14 AM, Francesco Cattoglio wrote: On Monday, 2 March 2015 at 15:01:55 UTC, Tobias Pankrath wrote: I'm really clueless... :P Something is wrong with your Material class, but you'll need to show us a reduced example. After a really long time I finally found what was wrong. http://dpaste.dzfl.pl/16d202b7124d Wow, I honestly could have NEVER foreseen this. This is all it takes for a class being unusable in a std.container.Array class MyClass { void init(); } Existing issue: https://issues.dlang.org/show_bug.cgi?id=12545 Ali