Thread overview | ||||||||
---|---|---|---|---|---|---|---|---|
|
May 29, 2016 [Issue 16093] Trivial case of passing a template function to another template function doesn't compile | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=16093 b2.temp@gmx.com changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |b2.temp@gmx.com --- Comment #1 from b2.temp@gmx.com --- It's because f is local. When f is static (i.e like a free function) it works void bar(alias f)() { f(); } void main() { static void f()() { } bar!f(); } The doc is not clear about this case. So even if this is invalid the doc needs at least to list exactly what's supported or not. https://issues.dlang.org/show_bug.cgi?id=5108 |
May 29, 2016 [Issue 16093] Trivial case of passing a template function to another template function doesn't compile | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=16093 --- Comment #2 from Max Samukha <maxsamukha@gmail.com> --- (In reply to b2.temp from comment #1) > It's because f is local. When f is static (i.e like a free function) it works > void main() { int x = 1; void f() { x += 1; } bar!f(); // ok } 'f' above is local, and the compiled program works as expected. Can't see why making it a template should affect the semantics. Also, if the following didn't compile, the whole "pass functions by alias" business would go down the drain: void bar(alias f)() { f(1); } void main() { int y = 1; alias f = (x) { y += x; }; // local, equivalent to "void f(A)(A x) { y += x; }" bar!f(); // ok } -- |
May 30, 2016 [Issue 16093] Trivial case of passing a template function to another template function doesn't compile | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=16093 Max Samukha <maxsamukha@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Severity|normal |critical --- Comment #3 from Max Samukha <maxsamukha@gmail.com> --- Raising severity because I've been unable to find an acceptable workaround. To make the absurdity of the current situation more obvious, it is possible to access a local template function if it is wrapped in a struct: void bar(alias f)() { f._f!(1, 2)(); } void main() { int y; void f(A...)() { y = A[0] + A[1]; } struct S { alias _f = f; } S s; bar!s(); assert(y == 3); // ok } This bug might be a regression as well because I am almost sure I didn't have this problem a couple of years ago. -- |
May 31, 2016 [Issue 16093] Trivial case of passing a template function to another template function doesn't compile | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=16093 --- Comment #4 from Max Samukha <maxsamukha@gmail.com> --- (In reply to Max Samukha from comment #0) > void bar(alias f)() { > f(); > } > > void main() { > void f()() { > } > bar!f(); > } > > Error: function test.main.f!().f is a nested function and cannot be accessed > from test.bar!(f).bar > Note that it compiles ok with -inline. -- |
March 21, 2020 [Issue 16093] Trivial case of passing a template function to another template function doesn't compile | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=16093 Basile-z <b2.temp@gmx.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC|b2.temp@gmx.com | -- |
December 17, 2022 [Issue 16093] Trivial case of passing a template function to another template function doesn't compile | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=16093 Iain Buclaw <ibuclaw@gdcproject.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Priority|P1 |P2 -- |
Copyright © 1999-2021 by the D Language Foundation