D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 6548 - [e2ir.c] Problem with ^^ vector op
Summary: [e2ir.c] Problem with ^^ vector op
Status: RESOLVED FIXED
Alias: None
Product: D
Classification: Unclassified
Component: dmd (show other issues)
Version: D2
Hardware: x86 Windows
: P2 normal
Assignee: No Owner
URL:
Keywords: patch
Depends on:
Blocks:
 
Reported: 2011-08-24 03:04 UTC by bearophile_hugs
Modified: 2011-09-26 09:48 UTC (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description bearophile_hugs 2011-08-24 03:04:49 UTC
void main() {
    auto _ = [1][] ^^ 2;
}


DMD 2.055beta output:

[1][] ^^ 2
Internal error: e2ir.c 683
Comment 1 Iain Buclaw 2011-08-26 14:45:20 UTC
Ahh, looks like it is leaking PowExp::toElem - didn't notice this as I have it implemented in GDC.

Best thing to immediately do is implement the missing methods as stubs (I was intending to move onto backend support and add constant folding/ctfe support for ^^ operations. :)
Comment 2 Iain Buclaw 2011-08-27 13:02:04 UTC
Can you see if you can break things in any way after this commit?

https://github.com/D-Programming-Language/dmd/pull/344

Regards
Iain
Comment 3 bearophile_hugs 2011-08-31 21:52:12 UTC
(In reply to comment #2)

> Regards
> Iain

Thank you for your work.
Comment 4 Iain Buclaw 2011-09-07 13:17:21 UTC
https://github.com/D-Programming-Language/dmd/pull/344/files


Finalised feature and added test cases.
Comment 5 bearophile_hugs 2011-09-26 04:28:19 UTC
(In reply to comment #2)
> Can you see if you can break things in any way after this commit?

Now this code doesn't crash DMD:

void main() {
    auto _ = [1][] ^^ 2;
}


But this code doesn't work yet:

import std.math;
void main() {
    int[5] a, b;
    b[] = a[] ^^ 2;
}


It gives:

...\dmd2\src\phobos\std\math.d(58): Error: module math is in file 'core\stdc\math.d' which cannot be read
Comment 6 bearophile_hugs 2011-09-26 09:48:04 UTC
Sorry, my Phobos was badly set. Things work now.