Test case: -------------------- // x.d: import y; struct A(alias f) { void front() { f(); } } void main() { int sectid; void g(){ cast(void) sectid; } // access a local variable (make a closure) s!(A!g); } -------------------- // y.d: void s(ROR)() { void r() { ROR().front(); } } -------------------- $ dmd -inline x Internal error: toir.c 190 -------------------- * If '-inline' is removed, the bug is gone. * If I suppress output by providing the '-o-' flag, the bug is gone. * If the function 's()' is moved into 'x.d', the bug is gone. * If the 'ROR().front()' call is not placed inside the function 'r', the ICE is gone, and the error becomes ----------------------- y.d(3): Error: function D main is a nested function and cannot be accessed from s x.d(11): Error: function D main is a nested function and cannot be accessed from s ----------------------- Maybe the same as issue 4504 or issue 5499, which also relates to function delegates. (I don't know if it is valid code or not, so I put both ice-on keywords :) )
Correction: -inline is *not* required. ---------------------------- $ dmd x Internal error: toir.c 190 ----------------------------
Fails also on Win32 2.059
(In reply to kennytm from comment #0) > Test case: > > -------------------- > // x.d: > import y; > struct A(alias f) { > void front() { > f(); > } > } > void main() { > int sectid; > void g(){ cast(void) sectid; } // access a local variable (make a > closure) > s!(A!g); > } > -------------------- > // y.d: > void s(ROR)() { > void r() { > ROR().front(); > } > } By fixing issue 8704, ROR() in y.d will produce "cannot access frame pointer of x.main" error from front-end layer. Then the glue-layer error will be fixed. *** This issue has been marked as a duplicate of issue 8704 ***