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 #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.