Bug 5754 – ICE(glue.c): using nested delegate literal as template alias parameter

Status
RESOLVED
Resolution
FIXED
Severity
regression
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
x86
OS
All
Creation time
2011-03-19T07:22:00Z
Last change time
2012-12-14T16:26:50Z
Keywords
ice
Assigned to
nobody
Creator
bearophile_hugs

Comments

Comment #0 by bearophile_hugs — 2011-03-19T07:22:11Z
import std.algorithm; void main() { int[] a = [1]; map!((int i){ return filter!((int j){ return i; })(a); })(a); } With DMD 2.052 gives: Assertion failure: '!vthis->csym' on line 703 in file 'glue.c' Equivalent Python 2.6 code: >>> a = [1] >>> map(lambda i: filter(lambda j: i, a), a) [[1]]
Comment #1 by kennytm — 2011-03-19T13:23:04Z
Any chance it is the same as issue 4129?
Comment #2 by kennytm — 2011-03-19T13:58:32Z
Reduced test case (I think): ---------------------------------- void x(alias pred)() { pred(); } void main() { x!((){ int i; // declare in outer scope x!((){ cast(void) i; // access in inner scope }); }); }
Comment #3 by clugdbug — 2011-09-07T15:24:09Z
See also bug 2962.
Comment #4 by lovelydear — 2012-04-20T10:15:31Z
Compiles and runs with 2.059 Win32
Comment #5 by lovelydear — 2012-04-20T10:17:15Z
I don't have the D1 compiler installed but it would be worth trying if issue 2962 is resolved as well.
Comment #6 by bearophile_hugs — 2012-12-14T16:23:59Z
(In reply to comment #4) > Compiles and runs with 2.059 Win32 Yes, both cases now compile. But I have found a way to trigger the same error. First module, named "module1.d": import std.stdio; import module2; void main() {} Second module, named "module2.d": import std.algorithm: reduce; struct Foo { string bar() { auto spam = (string s, int) => ""; return reduce!spam("", [1]); } } It generates, dmd 2.061alpha: Assertion failure: '!vthis->csym' on line 787 in file 'glue.c' Since you say this used to work before, it's now a regression.
Comment #7 by bearophile_hugs — 2012-12-14T16:26:50Z
Sorry, I guess it's a different bug, so I close this down and open another one. So ignore comment 6 please.