May 29, 2016 Weird "nested function cannot be accessed" error | ||||
---|---|---|---|---|
| ||||
This code fails to compile: void bar(alias f)() { f(); } void foo(alias f)() { bar!f(); } void main() { void f()() { } foo!f(); } Error: function test.main.f!().f is a nested function and cannot be accessed from test.bar!(f).bar But non-template nested functions are accepted: void main() { void f() { } foo!f(); // ok } What's going on here? |
Copyright © 1999-2021 by the D Language Foundation