Summary: Internal compiler error using std.algorithm.count with
                    recursive nested function in release.
           Product: D
           Version: D2
          Platform: x86_64
        OS/Version: Mac OS X
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD

--- Comment #0 from Peter Alexander <> 2010-07-25 
04:44:05 PDT ---
Compiling the following produces the error at compile time: "Internal error:
toir.c 190"

import std.algorithm;
import std.range;

void main()
    int foo(int i) { return i == 1 ? 1 : foo(1); }
    auto x = count(map!foo(iota(1, 2)), 1);

Only happens when:
- foo is recursive
- foo is a local function (doesn't happen if it is global)
- when using count (calling the function alone, or just mapping is fine)
- when compiling with (-inline)

If any one of these conditions isn't met then the code compiles as expected.

Note that while I have only noticed that std.algorithm.count causes this
problem, and doesn't, I haven't tested any other algorithms.

I'm using DMD 2.047.

Configure issuemail:
------- You are receiving this mail because: -------

Reply via email to