Bug 5522 – std.range.zip fails on arrays of Object.

Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P2
Component
phobos
Product
D
Version
D2
Platform
All
OS
All
Creation time
2011-02-03T06:44:00Z
Last change time
2011-09-17T04:17:27Z
Keywords
patch, rejects-valid
Assigned to
andrei
Creator
b.helyer

Attachments

IDFilenameSummaryContent-TypeSize
956emplace.patchPatch std.conv to allow emplace(ClassType* addr, [ClassType obj])text/plain1037

Comments

Comment #0 by b.helyer — 2011-02-03T06:44:31Z
import std.range; void main() { auto a = new Object[10]; zip(a); } Results in the following error: /usr/include/d/std/range.d(2814): Error: template std.conv.emplace(T,Args...) if (!is(T == class)) does not match any function template declaration /usr/include/d/std/range.d(2814): Error: template std.conv.emplace(T,Args...) if (!is(T == class)) cannot deduce template function from argument types !()(Object*,Object) /usr/include/d/std/range.d(2818): Error: template std.conv.emplace(T,Args...) if (!is(T == class)) does not match any function template declaration /usr/include/d/std/range.d(2818): Error: template std.conv.emplace(T,Args...) if (!is(T == class)) cannot deduce template function from argument types !()(Object*)
Comment #1 by kennytm — 2011-05-01T03:53:49Z
Created attachment 956 Patch std.conv to allow emplace(ClassType* addr, [ClassType obj]) The problem is std.conv.emplace cannot emplace a class-object T into a T* pointer, which is explicitly filtered out in several specializations. I don't know why. Here is a patch which simply add the required specializations. (I have not throughoutly checked if it breaks any unittests other than std.conv.)
Comment #2 by dmitry.olsh — 2011-09-17T04:17:27Z