https://issues.dlang.org/show_bug.cgi?id=12265
Tomoya Tanjo <[email protected]> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |[email protected] --- Comment #4 from Tomoya Tanjo <[email protected]> --- The above code does not work yet but it is due to a non-eponymous template rather than passing function as an alias parameter. Here is a reproducible code (also in https://run.dlang.io/is/DErgFM): ```dlang // eponymous template: infer pure template sortImpl1(alias pred, R) { void sortImpl1(R arr) { pred(arr[0], arr[1]); } } // non-eponymous template: failed to infer pure template sortImpl2(alias pred, R) { void sort(R arr) { pred(arr[0], arr[1]); } } void main() pure { int[] a = [1, 8, 3, 16]; sortImpl1!((a, b) => a < b, int[])(a); sortImpl2!((a, b) => a < b, int[]).sort(a); // line 23 } ``` I obtained the following error message: ``` onlineapp.d(23): Error: `pure` function `D main` cannot call impure function `onlineapp.main.sortImpl2!((a, b) => a < b, int[]).sort` ``` --
