www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 9277] New: [diagnostic] bad error message on illegal cast inside foreach

reply d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=9277

           Summary: [diagnostic] bad error message on illegal cast inside
                    foreach
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: druntime
        AssignedTo: nobody puremagic.com
        ReportedBy: dmitry.olsh gmail.com


--- Comment #0 from Dmitry Olshansky <dmitry.olsh gmail.com> 2013-01-07
01:26:56 PST ---
On dmd 2.061 the following (illegal) program:

void main()
{
    class Int
    {
        int _val;        
        this(int val){ _val = val; }
    }
    Int[] sink;

    foreach(v; 0..5_000)
        sink ~= [cast(Int)v]; //12
    foreach(v; 0..5_000)
        sink ~= cast(Int)v; //14
}

Produces:
bug.d(12): Error: e2ir: cannot cast v of type int to type bug.main.Int
bug.d(14): Error: e2ir: cannot cast v of type int to type bug.main.Int

The awful 'e2ir:' part of message seems to only trigger if v is coming from
foreach variable.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Jan 07 2013
next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=9277


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

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |diagnostic, pull
                 CC|                            |andrej.mitrovich gmail.com
          Component|druntime                    |DMD
         AssignedTo|nobody puremagic.com        |andrej.mitrovich gmail.com


--- Comment #1 from Andrej Mitrovic <andrej.mitrovich gmail.com> 2013-01-07
09:08:40 PST ---
https://github.com/D-Programming-Language/dmd/pull/1435

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Jan 07 2013
prev sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=9277


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

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|diagnostic, pull            |
         AssignedTo|andrej.mitrovich gmail.com  |nobody puremagic.com


--- Comment #2 from Andrej Mitrovic <andrej.mitrovich gmail.com> 2013-01-07
09:40:45 PST ---
Pull was wrong, this was not a diagnostic problem. The 'e2ir' is a minor ICE,
the error check should happen in the front-end. Once that is fixed this error
message will improve.

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