On 2011-03-23 21:51:17 +0100, Magnus Lie Hetland said:

When compiling a project I now get the following error from dmd (2.052, Mac OS X):

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

OK, I've managed to simplify thing down about as far as they can go, while still triggering this bug. As far as I can see, it requires two files (when I tried combining them, the error went away). Also, inlining is part of the problem, it seems. (Interestingly, when I try to use topN *without* my custom comparison, I get the error "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);
   }
}

And when I run foo.d, I get the assertion failure reported above.

Anyone recognize this as a known error?

--
Magnus Lie Hetland
http://hetland.org

Reply via email to