Bug 5776 – DMD assert. failure on topN with custom comparison/data in inner function
Status
RESOLVED
Resolution
WORKSFORME
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
Other
OS
Mac OS X
Creation time
2011-03-23T15:29:33Z
Last change time
2020-03-21T03:56:40Z
Keywords
ice
Assigned to
No Owner
Creator
Magnus Lie Hetland
Comments
Comment #0 by magnus — 2011-03-23T15:29:33Z
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);
}
}