Bug 12432 – Diagnostic on argument count mismatch for ranges and opApply should improve
Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2014-03-21T10:40:00Z
Last change time
2014-03-23T02:55:42Z
Keywords
diagnostic, pull
Assigned to
andrej.mitrovich
Creator
jlquinn
Comments
Comment #0 by jlquinn — 2014-03-21T10:40:52Z
import std.algorithm;
void foo(string line) {
foreach (int i,string tok; splitter(line, " ")) {}
}
~/dmd2/linux/bin64/dmd -c junk.d
junk.d(5): Error: cannot infer argument types
This is dmd 2.065.0 on ubuntu 64 bit.
Removing the int i fixes the problem.
I think I recall seeing something about trying to use an index variable with a forward range. It's nice to be able to use the var, even if I'm not trying to index into the range.
More importantly, the error message is completely opaque.
Comment #1 by andrej.mitrovich — 2014-03-21T11:35:40Z