D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 4135 - Regression(1.034): ICE(statement.c): mixin in bad foreach, D1 only
Summary: Regression(1.034): ICE(statement.c): mixin in bad foreach, D1 only
Status: RESOLVED FIXED
Alias: None
Product: D
Classification: Unclassified
Component: dmd (show other issues)
Version: D1 (retired)
Hardware: Other Linux
: P2 regression
Assignee: No Owner
URL:
Keywords: ice-on-invalid-code
Depends on:
Blocks:
 
Reported: 2010-04-30 17:31 UTC by Ellery Newcomer
Modified: 2014-02-15 02:19 UTC (History)
3 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description Ellery Newcomer 2010-04-30 17:31:57 UTC
On compiling the files in the below zip file (with unittesting), I get

dmd: statement.c:138: virtual int Statement::blockExit(): Assertion `0' failed.

There's a fair deal of code in there, but I believe its coming from TestRecords, for anyone bothering to whittle this one down.

http://personal.utulsa.edu/~ellery-newcomer/dxltest.zip
Comment 1 bearophile_hugs 2010-04-30 17:51:16 UTC
I don't think it's fair for Walter or Don to debug your code. So I suggest you to first of all merge all that code in a single module, then start removing parts and keep that ICE, until you reach to a short enough program to post here again.
Comment 2 Ellery Newcomer 2010-04-30 20:04:52 UTC
I think it's fair for Walter or Don to debug their code.

Anyways, I lied about TestRecords.

This is as small as I care to get it:

public int blitvisit()() {
    foreach(k; s.tupleof){
            mixin(BlitX!());
    }
}

void main(){
    blitvisit!()();
}
Comment 3 bearophile_hugs 2010-05-01 03:08:37 UTC
If you post several modules here then you are asking people to debug your code.

Your last code doesn't show the ICE, it just shows:
test.d(2): Error: undefined identifier s
Comment 4 Don 2010-08-14 13:14:47 UTC
This is D1-only. Reduced test case:

void bug4125() {
    foreach(k; s){
        mixin("");
    }
}
--------
test0.d(384): Error: undefined identifier s
test0.d(384): Error: cannot infer type for k
Statement::blockExit(00C17914)
mixin("");

Passed in 1.030, ICE in 1.034.
Comment 6 Walter Bright 2011-12-19 10:01:58 UTC
The fix was:

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