[Issue 11955] New: win32 foreach "size_t" degrades to "uint"

d-bugmail at puremagic.com d-bugmail at puremagic.com
Mon Jan 20 04:28:27 PST 2014


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

           Summary: win32 foreach "size_t" degrades to "uint"
           Product: D
           Version: D2
          Platform: x86
        OS/Version: Windows
            Status: NEW
          Severity: blocker
          Priority: P2
         Component: DMD
        AssignedTo: nobody at puremagic.com
        ReportedBy: monarchdodra at gmail.com


--- Comment #0 from monarchdodra at gmail.com 2014-01-20 04:28:24 PST ---
Originally discovered while playing with JakobOvrum's enumrate:
https://github.com/D-Programming-Language/phobos/pull/1866

I can reduce it to a simple range that returns a Tuple!(size_t, int). On
win_32, this fails:

//----
import std.typetuple, std.typecons;

alias ET = Tuple!(size_t, int);

struct S
{
    enum empty = false;
    ET front() @property;
    void popFront();
}

void main()
{
    S s; //Or replace with "somthing.enumerate()"
    foreach(i, v; s)
    {
        pragma(msg, typeof(i).stringof);
        pragma(msg, typeof(v).stringof);
    }
    foreach(size_t i, int v; s)
    {}
}
//----

Compilation output:
//----
uint
int
main.d(20): Error: cannot infer argument types
//----

I only tested this on win_32, so I don't know how the other os's (linux), or
versions (64) behave.

While I don't think it is a hugely serious bug, it is also blocker in terms of
portability.

-- 
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