Bug 3082 – Forward Reference Issues w/ Template Literals

Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P2
Component
phobos
Product
D
Version
D2
Platform
Other
OS
Windows
Creation time
2009-06-19T10:50:00Z
Last change time
2015-06-09T01:27:59Z
Assigned to
nobody
Creator
dsimcha

Comments

Comment #0 by dsimcha — 2009-06-19T10:50:21Z
Comment #1 by dsimcha — 2009-06-19T10:53:14Z
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 by dsimcha — 2010-08-15T21:19:28Z
This is one of the many bugs that depended on bug 3294 and therefore got resolved when 3294 did.