[Issue 5939] Cannot copy std.algorithm.map

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sun May 8 22:41:55 PDT 2011


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



--- Comment #4 from Walter Bright <bugzilla at digitalmars.com> 2011-05-08 22:37:58 PDT ---
I'm going to argue this is not a compiler bug.

The return type from map (call it T) is a private, opaque data type. The only
way to get an instance of T is by calling map(). T cannot be default
constructed - hence the error message.

This is why:

    auto a = map!"a"([0]);

works, and

    typeof(map!"a"([0])) a;

fails.

Note that you can do:

    typeof(map!"a"([0])) a = void;

because no default construction is attempted.

The default construction cannot happen outside of map() because it requires the
stack frame of map() to do it.

The error message, of course, is not so easy to decipher.

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