Bug 5499 – ICE(toir.c): delegate as alias template parameter, only with -inline

Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D1 (retired)
Platform
All
OS
All
Creation time
2011-01-28T14:06:00Z
Last change time
2012-05-22T14:19:59Z
Keywords
ice
Assigned to
nobody
Creator
bearophile_hugs
See also
http://d.puremagic.com/issues/show_bug.cgi?id=8024

Comments

Comment #0 by bearophile_hugs — 2011-01-28T14:06:07Z
void foo(alias f)() { foo!f(); } void bar() { foo!({})(); } void main() { void spam() { bar(); } } Compiling it in -release with dmd 2.051 gives: Internal error: toir.c 190
Comment #1 by clugdbug — 2011-01-28T14:30:11Z
I couldn't reproduce this until I used -inline as well as -release. Looks similar to bug 4504, but this test case is shorter, and 4504 doesn't require -release.
Comment #2 by bearophile_hugs — 2011-01-28T14:32:57Z
Sorry, I meant just -inline.
Comment #3 by clugdbug — 2011-01-29T05:52:33Z
Here's an interesting variation. Without -inline, it compiles correctly, but if -inline is set, it generates: test0.d(2): Error: function test0.bar.foo!(delegate void(){}).foo is a nested function and cannot be accessed from main ===== void foo(alias f)(int x) { if (x>1) foo!f(x-1); } void bar() { foo!({})(2); } void main() { bar(); }
Comment #4 by code — 2011-12-27T11:37:16Z
*** Issue 7164 has been marked as a duplicate of this issue. ***
Comment #5 by hoganmeier — 2012-01-20T05:06:08Z
(In reply to comment #3) Same as http://d.puremagic.com/issues/show_bug.cgi?id=4841 ?
Comment #6 by leandro.lucarella — 2012-05-03T04:36:04Z
Another simpler test case, or is this another bug? --- void foo(alias f)() { f(); } void bar() { foo!({})(); } void main() { bar(); } --- m1.d(1): Error: function m1.bar.foo!(delegate void() { } ).foo is a nested function and cannot be accessed from main
Comment #7 by leandro.lucarella — 2012-05-03T04:36:34Z
(In reply to comment #6) > Another simpler test case, or is this another bug? > > --- > void foo(alias f)() { > f(); > } > > void bar() { > foo!({})(); > } > > void main() { > bar(); > } > --- > > m1.d(1): Error: function m1.bar.foo!(delegate void() > { > } > ).foo is a nested function and cannot be accessed from main Maybe is another bug because this is D1 only.
Comment #8 by leandro.lucarella — 2012-05-03T04:37:47Z
But the testcases provided here compiles in current dmd2!
Comment #9 by leandro.lucarella — 2012-05-03T05:08:59Z
Added a new bug 8024 for the case that only fails to compile.
Comment #10 by bearophile_hugs — 2012-05-22T14:19:59Z
(In reply to comment #9) > Added a new bug 8024 for the case that only fails to compile. Now (dmd 2.060alpha) all test cases seems to compile (including the one in Bug 8024 ), so I close this.