[Issue 3082] Forward Reference Issues w/ Template Literals

d-bugmail at puremagic.com d-bugmail at puremagic.com
Fri Jun 19 10:53:17 PDT 2009


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


David Simcha <dsimcha at yahoo.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
          Component|DMD                         |Phobos




--- Comment #1 from David Simcha <dsimcha at yahoo.com>  2009-06-19 10:53:14 PDT ---
Sorry, accidentally submitted before finishing.  Anyhow, the following bug
makes template literals near useless when used w/ ranges.  I think it has to do
with the way unaryFun works, but I'm not sure.

import std.algorithm;

struct Foo {
    uint num;
}

void main() {
    Foo[] foos;
    auto bar = map!( (a) { return a.num; } )(foos);
}

C:\dmd\windows\bin\..\..\src\phobos\std\algorithm.d(120): Error: forward
reference to type __T2
C:\dmd\windows\bin\..\..\src\phobos\std\algorithm.d(120): Error: cannot
implicitly convert expression (Foo) of type Foo to __T2
C:\dmd\windows\bin\..\..\src\phobos\std\algorithm.d(120): Error: forward
reference to inferred return type of function call
__dgliteral1(cast(__T2)(Foo))
C:\home\dsimcha\bin\test.d(111): Error: template instance
test.main.Map!(__dgliteral1,Foo[]) error instantiating
Process terminated with status 1 (0 minutes, 0 seconds)

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