[Issue 12432] New: cryptic error using splitter in foreach

d-bugmail at puremagic.com d-bugmail at puremagic.com
Fri Mar 21 10:40:56 PDT 2014


https://d.puremagic.com/issues/show_bug.cgi?id=12432

           Summary: cryptic error using splitter in foreach
           Product: D
           Version: D2
          Platform: x86_64
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Phobos
        AssignedTo: nobody at puremagic.com
        ReportedBy: jlquinn at optonline.net


--- Comment #0 from Jerry Quinn <jlquinn at optonline.net> 2014-03-21 10:40:52 PDT ---
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.

-- 
Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list