www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 2800] New: Zeal excess in automatic conversion when using foreach and alias this

reply d-bugmail puremagic.com writes:
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 digitalmars.com
        ReportedBy: andrei 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)


-- 
Apr 04 2009
parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=2800


Shin Fujishiro <rsinfu gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |rsinfu gmail.com
         Resolution|                            |FIXED


--- Comment #1 from Shin Fujishiro <rsinfu gmail.com> 2010-09-27 21:47:16 PDT
---
It was fixed in release 2.028.

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