Bug 4467 – type deduction fails when combining array() and uniq()
Status
RESOLVED
Resolution
DUPLICATE
Severity
normal
Priority
P2
Component
phobos
Product
D
Version
D2
Platform
x86
OS
Windows
Creation time
2010-07-15T15:55:00Z
Last change time
2010-07-15T19:40:14Z
Keywords
rejects-valid
Assigned to
nobody
Creator
Jesse.K.Phillips+D
Comments
Comment #0 by Jesse.K.Phillips+D — 2010-07-15T15:55:40Z
This code (or code similar to it) use to work within the last 4 releases. I don't know whether it is a bug in Phobos or DMD.
import std.algorithm;
import std.array;
void main() {
auto a = ["hello", "there", "you", "allow", "you", "me"];
auto b = array(uniq(a));
}
test.d(7): Error: template std.array.array(Range) if (isForwardRange!(Range)) does not match any function template declaration
test.d(7): Error: template std.array.array(Range) if (isForwardRange!(Range)) cannot deduce template function from argument types !()(Uniq!(pred,string[]))
Comment #1 by yebblies — 2010-07-15T19:40:14Z
This is a phobos bug caused by the addition of save() to the definition of a forward range.
Uniq is one of around 22 ranges in phobos that appear to be forward ranges but have not been updated to meet this requirement. (bug4363)
*** This issue has been marked as a duplicate of issue 4363 ***