Thread overview
[Issue 5522] New: std.range.zip fails on arrays of Object.
Feb 03, 2011
Bernard Helyer
May 01, 2011
kennytm@gmail.com
Sep 17, 2011
Dmitry Olshansky
February 03, 2011
http://d.puremagic.com/issues/show_bug.cgi?id=5522

           Summary: std.range.zip fails on arrays of Object.
           Product: D
           Version: D2
          Platform: Other
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Phobos
        AssignedTo: nobody@puremagic.com
        ReportedBy: blood.of.life@gmail.com


--- Comment #0 from Bernard Helyer <blood.of.life@gmail.com> 2011-02-03 06:44:31 PST ---
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*)

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
February 03, 2011
http://d.puremagic.com/issues/show_bug.cgi?id=5522


Andrei Alexandrescu <andrei@metalanguage.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |ASSIGNED
                 CC|                            |andrei@metalanguage.com
         AssignedTo|nobody@puremagic.com        |andrei@metalanguage.com


-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
May 01, 2011
http://d.puremagic.com/issues/show_bug.cgi?id=5522



--- Comment #1 from kennytm@gmail.com 2011-05-01 03:53:49 PDT ---
Created an attachment (id=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.)

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
September 17, 2011
http://d.puremagic.com/issues/show_bug.cgi?id=5522


Dmitry Olshansky <dmitry.olsh@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
                 CC|                            |dmitry.olsh@gmail.com
         Resolution|                            |FIXED


--- Comment #2 from Dmitry Olshansky <dmitry.olsh@gmail.com> 2011-09-17 04:17:27 PDT ---
Fixed in: https://github.com/D-Programming-Language/phobos/commit/65a0c2158b1d2ea8e9d3094746739da636266089

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------