[Issue 2800] New: Zeal excess in automatic conversion when using foreach and alias this

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sat Apr 4 13:12:46 PDT 2009


http://d.puremagic.com/issues/show_bug.cgi?id=2800

           Summary: Zeal excess in automatic conversion when using foreach
                    and alias this
           Product: D
           Version: unspecified
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: bugzilla at digitalmars.com
        ReportedBy: andrei at metalanguage.com


struct Tuple(U...)
{
    U field;
    alias field this;
}

struct Iter
{
    bool empty();
    void next();
    ref Tuple!(int, int) head();
}

void main()
{
    foreach (a; Iter())
    {
    }
}

yields:

./test.d(16): Error: cannot implicitly convert expression
(tuple(cast(Tuple!(int,int))__r1.head()._field_field_0,cast(Tuple!(int,int))__r1.head()._field_field_1))
of type (int, int) to Tuple!(int,int)
./test.d(16): Error: cannot implicitly convert expression
(tuple(cast(Tuple!(int,int))__r1.head()._field_field_0,cast(Tuple!(int,int))__r1.head()._field_field_1))
of type (int, int) to Tuple!(int,int)


-- 



More information about the Digitalmars-d-bugs mailing list