Bug 5596 – Regression(2.052): Different template alias parameters to the same literal result in different template instances

Status
RESOLVED
Resolution
FIXED
Severity
regression
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2011-02-16T07:46:00Z
Last change time
2011-08-03T20:31:22Z
Keywords
patch, rejects-valid
Assigned to
nobody
Creator
dsimcha

Comments

Comment #0 by dsimcha — 2011-02-16T07:46:16Z
The following code works on 2.051 but not 2.052 beta: import std.range, std.algorithm, std.functional; alias SortedRange!(string[], "a < b") Set; Set readTfList(string setFile) { string[] raw; return pipe!(sort, uniq, array, assumeSorted)(raw); }
Comment #1 by dsimcha — 2011-02-16T07:46:57Z
Forgot to paste in the error message. Here it is: d:\dmd2\windows\bin\..\..\src\phobos\std\range.d(5415): Error: this for _input needs to be type SortedRange not type SortedRange!(string[],"a < b")
Comment #2 by dsimcha — 2011-02-16T19:33:35Z
Here's a better-reduced test case. Also see the comments in the test case for some insight into what's going on here. import std.range; // This alias is necessary but not sufficient to reproduce the bug. Even // changing the white space in the comparison function, i.e. "a < b" -> "a<b", // prevents this bug from being reproduced. Must have to do with multiple // attempts to instantiate SortedRange with the same parameters. alias SortedRange!(string[], "a < b") Set; void main() { string[] raw; auto foo = assumeSorted(raw); }
Comment #3 by dsimcha — 2011-02-16T19:48:48Z
Also note that changing the comparison function in the assumeSorted line makes this bug go away, too.
Comment #4 by yebblies — 2011-07-12T03:36:47Z
Reduced: struct X(alias a) { void fx() { a = 4; } int a; } alias X!"a" x; void y(alias b)() { X!b g; } void main() { y!("a")(); }
Comment #5 by yebblies — 2011-07-12T04:25:54Z
Comment #6 by k.hara.pg — 2011-07-19T23:06:32Z
This is same as issue 5046, and already fixed in D2.
Comment #7 by braddr — 2011-08-03T20:31:22Z
Confirmed that the test case in comment 4 works now as does the code in the description. Closing.