www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 12432] New: cryptic error using splitter in foreach

reply d-bugmail puremagic.com writes:
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 puremagic.com
        ReportedBy: jlquinn optonline.net


--- Comment #0 from Jerry Quinn <jlquinn 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: -------
Mar 21 2014
next sibling parent d-bugmail puremagic.com writes:
https://d.puremagic.com/issues/show_bug.cgi?id=12432


Andrej Mitrovic <andrej.mitrovich gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |pull


--- Comment #1 from Andrej Mitrovic <andrej.mitrovich gmail.com> 2014-03-21
11:35:40 PDT ---
https://github.com/D-Programming-Language/dmd/pull/3396

-- 
Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Mar 21 2014
prev sibling next sibling parent d-bugmail puremagic.com writes:
https://d.puremagic.com/issues/show_bug.cgi?id=12432



--- Comment #2 from github-bugzilla puremagic.com 2014-03-23 01:55:57 PDT ---
Commits pushed to master at https://github.com/D-Programming-Language/dmd

https://github.com/D-Programming-Language/dmd/commit/a38a23830977a42f9b36a51d7e4e7a6e9b917ad1
Fix Issue 12432 - Implement better diagnostics for argument count mismatch in
range and opApply contexts.

https://github.com/D-Programming-Language/dmd/commit/86d59a72df020fedc6e3bc87a885fa969121ea3e
Merge pull request #3396 from AndrejMitrovic/Fix12432

Issue 12432 - Better diagnostics for argument count mismatch in range and
opApply

-- 
Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Mar 23 2014
prev sibling parent d-bugmail puremagic.com writes:
https://d.puremagic.com/issues/show_bug.cgi?id=12432


Andrej Mitrovic <andrej.mitrovich gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED


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