Bug 8147 – Blah!R.init now requires parens - (Blah!R).init
Status
RESOLVED
Resolution
FIXED
Severity
regression
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2012-05-25T02:56:00Z
Last change time
2015-06-09T05:15:17Z
Keywords
pull, rejects-valid
Assigned to
nobody
Creator
issues.dlang
Comments
Comment #0 by issues.dlang — 2012-05-25T02:56:38Z
In 2.059, this compiles:
import std.algorithm;
import std.conv;
enum A { a, b, c }
void main()
{
map!"to!string(a)"([A.a]);
}
But with the latest head, you get this error:
/home/jmdavis/dmd2/linux/bin/../../src/phobos/std/algorithm.d(382): Error: undefined identifier 'init'
q.d(8): Error: template instance std.algorithm.map!("to!string(a)").map!(A[]) error instantiating
The offending line is line# 382 of std.algorithm:
alias typeof(_fun(.ElementType!R.init)) ElementType;
If you put parens around .ElementType!R, then it compiles, but without them, it now fails. So, from the looks of it, the compiler now associates the .init with R instead of the result of .ElementType!R.
If this was a purposeful change, then map needs to be changed. However, if it was an accidental change (as I assume that it was), then dmd needs to be fixed.