On Sunday, 17 May 2015 at 09:59:41 UTC, Daniel Kozak wrote:

On Sun, 17 May 2015 09:33:27 +0000
Namespace via Digitalmars-d-learn <digitalmars-d-learn@puremagic.com> wrote:

On Sunday, 17 May 2015 at 09:30:16 UTC, Gary Willoughby wrote:
> On Sunday, 17 May 2015 at 09:25:33 UTC, Namespace wrote:
>> Is this error an ICE? I think so, because I see the >> internal filename, but I'm not sure.
>>
>> Error: e2ir: cannot cast malloc(length * 8u) of type void* >> to type char[]
>
> Have you got a code sample to reproduce this?

Of course:

----
void main() {
        import core.stdc.stdlib : malloc, free;

        auto ptr = cast(char[]) malloc(42);
}
----

I guess it should be:

auto ptr = cast(char*)malloc(42)[0 .. 42];

That would work, but I did it on purpose. I wanted to test whether such dangerous code compiles or whether the compiler is smart enough and hits the alarm.
  • ICE? Namespace via Digitalmars-d-learn
    • Re: ICE? Gary Willoughby via Digitalmars-d-learn
      • Re: ICE? Namespace via Digitalmars-d-learn
        • Re: ICE? Daniel Kozak via Digitalmars-d-learn
        • Re: ICE? Daniel Kozak via Digitalmars-d-learn
        • Re: ICE? Namespace via Digitalmars-d-learn
          • Re: ICE? Daniel Kozak via Digitalmars-d-learn
    • Re: ICE? Daniel Kozak via Digitalmars-d-learn
      • Re: ICE? anonymous via Digitalmars-d-learn
        • Re: ICE? Daniel Kozak via Digitalmars-d-learn
      • Re: ICE? ketmar via Digitalmars-d-learn
    • Re: ICE? Daniel Kozak via Digitalmars-d-learn

Reply via email to