Code below trigger an ICE. It is likely that dmd suffer from the same bug but don't detect it in the backend. import std.algorithm; class A { } class B { A a; } class C { void visit(B b) { auto as = [b.a]; as.map!(d => d); } } gdc output : /opt/gdc/include/d/4.8.0/std/algorithm.d: In member function 'bug.C.visit.map!(__lambda2).map!(A[]).map': /opt/gdc/include/d/4.8.0/std/algorithm.d:380: internal compiler error: in expand_expr_real_1, at expr.c:9266 0x71c376 expand_expr_real_1(tree_node*, rtx_def*, machine_mode, expand_modifier, rtx_def**) ../../gcc-4.8-20121007/gcc/expr.c:9261 0x723471 store_expr(tree_node*, rtx_def*, int, bool) ../../gcc-4.8-20121007/gcc/expr.c:5180 0x72807e expand_assignment(tree_node*, tree_node*, bool) ../../gcc-4.8-20121007/gcc/expr.c:4826 0x67d76f expand_gimple_stmt_1 ../../gcc-4.8-20121007/gcc/cfgexpand.c:2106 0x67d76f expand_gimple_stmt ../../gcc-4.8-20121007/gcc/cfgexpand.c:2202 0x67eb84 expand_gimple_basic_block ../../gcc-4.8-20121007/gcc/cfgexpand.c:3965 0x6807a3 gimple_expand_cfg ../../gcc-4.8-20121007/gcc/cfgexpand.c:4484 Please submit a full bug report, with preprocessed source if appropriate. Please include the complete backtrace with any bug report. See <http://gdcproject.org/bugzilla> for instructions.
It's entirely possible that it's a problem in the gcc backend. I've tested on a copy from 08/07/2012 and can't reproduce. Regards Iain
.
On further analysis looks to be a custom static chain bug... In the map!() template, we emit this code: { struct MapResult __ctmp997 = {}; __ctmp.this = this; // 'this' is in another context that we can't access for here. return <retval> = *__ctor (&__ctmp997, r); } Maybe will see if DMD does the same...
https://github.com/D-Programming-GDC/GDC/commit/20c0b776702947a338afc953ba35234425994c65
*** Bug 20 has been marked as a duplicate of this bug. ***
(In reply to comment #4) > https://github.com/D-Programming-GDC/GDC/commit/20c0b776702947a338afc953ba35234425994c65 So this is finally not related to dmd ?
(In reply to comment #6) > (In reply to comment #4) > > https://github.com/D-Programming-GDC/GDC/commit/20c0b776702947a338afc953ba35234425994c65 > > So this is finally not related to dmd ? Never said it was related to dfe. :)