Bug 5617 – repeat(value, n) fails to compile

Status
RESOLVED
Resolution
INVALID
Severity
normal
Priority
P2
Component
phobos
Product
D
Version
D2
Platform
x86
OS
Linux
Creation time
2011-02-19T21:41:00Z
Last change time
2015-06-09T05:14:59Z
Assigned to
nobody
Creator
issues.dlang

Comments

Comment #0 by issues.dlang — 2011-02-19T21:41:43Z
Take this program: import std.range; void main() { auto a = take(repeat(5), 2); auto b = repeat(5, 2); } results in test.d(6): Error: template std.range.repeat(T) does not match any function template declaration test.d(6): Error: template std.range.repeat(T) cannot deduce template function from argument types !()(int,int) The first line in main compiles but the second doesn't, even though the two lines are supposed to be equivalent. What's particularly baffling is that the body of repeat(value, n) is essentially identical to the first line in main. So, I really don't know what's going on here, but regardless, repeat(value, n) appears to be broken.
Comment #1 by issues.dlang — 2011-02-19T22:06:00Z
Okay. I take that back. It appears to be something wrong with my system. For some reason, if I'm in my home directory, it's grabbing the wrong libphobos2.a or something. I have no clue what the deal with it is, but there are other problems (such as there being no std.array.join and there being a std.string.join) which indicate that the wrong libphobos2.a is being used when I build from my home directory. So, I expect that repeat(value, n) is a newer version of the function that whatever version of the library is being pulled in doesn't have. In any case, this isn't a real bug. It's just something weird with my system that I'll have to sort out, which makes a _lot_ more sense to me (much as my problem doesn't make sense), since looking at repeat, I can't see how the error that I'm getting could possibly happen with the current version of Phobos. The function is just so simple that it seems like it _has_ to work.