D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 4784 - ICE(toir.c) with count()
Summary: ICE(toir.c) with count()
Status: RESOLVED DUPLICATE of issue 4504
Alias: None
Product: D
Classification: Unclassified
Component: dmd (show other issues)
Version: D2
Hardware: x86 Windows
: P2 normal
Assignee: No Owner
URL:
Keywords: ice-on-valid-code
Depends on:
Blocks:
 
Reported: 2010-09-01 10:27 UTC by bearophile_hugs
Modified: 2010-11-22 02:12 UTC (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description bearophile_hugs 2010-09-01 10:27:12 UTC
import std.algorithm: count;
import std.range: iota;
void main() {
    int[] foo(R)(R m) {
        count!((a){ return true; })(m);
        return [];
    }
    foo(foo(iota(1)));
}


DMD 2.048 returns:
Internal error: toir.c 190
Comment 1 osa8aso 2010-09-23 09:53:16 UTC
I got the same ICE (dmd 2.048 on linux) and was able to reduce the problem to a small test case which does not involve any libraries like std.algorithm:

struct A( alias P ) {
    static void a() {
        void aa() { P(); }
    }
}

template B( alias P ) {
    void b() { A!P a; }
}

struct C( alias P ) {
    void c() { B!P.b(); }
}
    
void main() {
    void bar() {}
    C!bar c;
}

Compiling this produces the same error:
Internal error: toir.c 190
Comment 2 Don 2010-11-22 02:12:16 UTC

*** This issue has been marked as a duplicate of issue 4504 ***