D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 3082 - Forward Reference Issues w/ Template Literals
Summary: Forward Reference Issues w/ Template Literals
Status: RESOLVED FIXED
Alias: None
Product: D
Classification: Unclassified
Component: phobos (show other issues)
Version: D2
Hardware: Other Windows
: P2 normal
Assignee: No Owner
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-06-19 10:50 UTC by David Simcha
Modified: 2015-06-09 01:27 UTC (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description David Simcha 2009-06-19 10:50:21 UTC

    
Comment 1 David Simcha 2009-06-19 10:53:14 UTC
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)
Comment 2 David Simcha 2010-08-15 21:19:28 UTC
This is one of the many bugs that depended on bug 3294 and therefore got resolved when 3294 did.