Comment #0 by verylonglogin.reg — 2013-11-09T10:36:16Z
---
void main()
{
float[1] f1;
auto i = cast(int) f1;
}
---
main.d(4): Error: e2ir: cannot cast f1 of type float[1] to type int
---
Comment #1 by verylonglogin.reg — 2013-11-09T11:03:09Z
Same ICE in reverse direction. Let's cast `Object` now:
---
void main()
{
Object o; // or an array, or a pointer,...
auto i1 = cast(int[1]) o;
}
---
main.d(4): Error: e2ir: cannot cast i of type int to type float[1]
---
Comment #2 by maxim — 2013-11-09T12:01:38Z
And what will exactly the code
void main()
{
Object o; // or an array, or a pointer,...
auto i1 = cast(int[1]) o;
}
produce? A class instance converted to a pointer converted to an integer converted to a static integer array of 1 element? Why stop here? Why not
struct S
{
int[1] data;
}
S s = cast(S)new Object()
and making the exact chain above plus creating struct from static array?
Comment #3 by verylonglogin.reg — 2013-11-09T12:53:06Z
(In reply to comment #2)
> And what will exactly the code produce?
An ICE. A normal compiler error is expected.
Comment #4 by maxim — 2013-11-09T13:28:23Z
(In reply to comment #3)
> (In reply to comment #2)
> > And what will exactly the code produce?
>
> An ICE. A normal compiler error is expected.
It is an error.
If you look into usual practice of tagging, you will see that these issues are not ice, because there is no compiler crashes, segfaults, overflows, etc. Better keyword is probably diagnostic. The only detail which can be argued to be 'compiler internal' is mentioning 'e2ir' which does not affect anything. Do you consider
struct S { this(this) {} }
struct SS
{
const(S) s;
}
Error: mutable method f167.S.__postblit is not callable using a const object
an ice because '__postblit' is 'internal error message'?
What is more important, is that all these issues filed against 'e2ir' are useless. There is no need to spend time on inventing cases which produces 'e2ir' and pusing dozens of them to bugzilla because all these 'ICEs' are fixable using grep within several minutes.
Comment #5 by verylonglogin.reg — 2013-11-10T08:14:12Z
(In reply to comment #4)
> (In reply to comment #3)
> > (In reply to comment #2)
> > > And what will exactly the code produce?
> >
> > An ICE. A normal compiler error is expected.
>
> It is an error.
See Issue 3537 Comment 3.
Comment #6 by yebblies — 2013-11-14T23:37:57Z
(In reply to comment #4)
>
> What is more important, is that all these issues filed against 'e2ir' are
> useless. There is no need to spend time on inventing cases which produces
> 'e2ir' and pusing dozens of them to bugzilla because all these 'ICEs' are
> fixable using grep within several minutes.
Completely wrong. All of the 'e2ir' errors are produced in the glue layer, not the frontend. This means: semantic fails to reject this code, interpreter sees broken code, compiling with -o- fails to detect an error.
These are internal compiler errors, the fact that it doesn't crash it irrelevant.