[Issue 9277] New: [diagnostic] bad error message on illegal cast inside foreach
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Mon Jan 7 01:26:58 PST 2013
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 at puremagic.com
ReportedBy: dmitry.olsh at gmail.com
--- Comment #0 from Dmitry Olshansky <dmitry.olsh at 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: -------
More information about the Digitalmars-d-bugs
mailing list