D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 5776 - DMD assert. failure on topN with custom comparison/data in inner function
Summary: DMD assert. failure on topN with custom comparison/data in inner function
Status: RESOLVED WORKSFORME
Alias: None
Product: D
Classification: Unclassified
Component: dmd (show other issues)
Version: D2
Hardware: Other Mac OS X
: P2 normal
Assignee: No Owner
URL:
Keywords: ice
Depends on:
Blocks:
 
Reported: 2011-03-23 15:29 UTC by Magnus Lie Hetland
Modified: 2020-03-21 03:56 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 Magnus Lie Hetland 2011-03-23 15:29:33 UTC
Running DMD 2.052 on OS X. When I try to compile the following program (two files), by executing foo.d, I get the error

Assertion failed: (!vthis->csym), function toObjFile, file glue.c, line 703.

If I try to compile without myLess, I get:

Error: function std.algorithm.topN!("a < b",cast(SwapStrategy)0,uint[]).topN compiler error, parameter 'r', bugzilla 2962?"

// foo.d:
#!/usr/bin/env rdmd -inline
import std.random;
import bar;
void main() {
    func();
}

// bar.d:
import std.algorithm;
void func() {
    bool myLess(uint a, uint b) {
        return a < b;
    }
    void inner(uint[] slice) {
        topN!myLess(slice, 0);
    }
}