Thread overview
[Issue 7450] New: AA: Cannot uniquely infer foreach argument types
Feb 06, 2012
Andrej Mitrovic
Apr 19, 2012
SomeDude
Apr 19, 2012
Andrej Mitrovic
February 06, 2012
http://d.puremagic.com/issues/show_bug.cgi?id=7450

           Summary: AA: Cannot uniquely infer foreach argument types
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: druntime
        AssignedTo: nobody@puremagic.com
        ReportedBy: andrej.mitrovich@gmail.com


--- Comment #0 from Andrej Mitrovic <andrej.mitrovich@gmail.com> 2012-02-06 01:45:43 PST ---
void main()
{
    string[string] hash;
    hash["foo"] = "";

    foreach (name; hash.byKey())
    {
        assert(typeid(string) == typeid(name));  // ok
    }

    // Error: cannot uniquely infer foreach argument types
    foreach (string name; hash.byKey())
    {
    }
}

I'm confused, why can't I specify the type? It ends up being a string if I don't set it..

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
April 19, 2012
http://d.puremagic.com/issues/show_bug.cgi?id=7450


SomeDude <lovelydear@mailmetrash.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |lovelydear@mailmetrash.com


--- Comment #1 from SomeDude <lovelydear@mailmetrash.com> 2012-04-19 15:26:11 PDT ---
This compiles and runs with 2.059.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
April 19, 2012
http://d.puremagic.com/issues/show_bug.cgi?id=7450


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

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


--- Comment #2 from Andrej Mitrovic <andrej.mitrovich@gmail.com> 2012-04-19 15:44:22 PDT ---
Hmm.. I can't recreate this in 2.057 either. It does crash DMD 2.053 though, so it might have been some kind of lurking bug somewhere.. I'll close it now though.

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