Clash When Using Function as Template Value-Parameters?
Vijay Nayar
madric at gmail.com
Sun May 27 07:03:12 UTC 2018
On Saturday, 26 May 2018 at 11:56:30 UTC, Vijay Nayar wrote:
> The error is:
> ```
> onlineapp.d(8): Error: function literal `__lambda6(char a)` is
> not callable using argument types `(int)`
> onlineapp.d(8): cannot pass argument `val` of type `int`
> to parameter `char a`
> onlineapp.d(15): Error: template instance
> `onlineapp.BTree!(int, int, function (char a) => a)` error
> instantiating
> ```
Just to clarify. In the example above, if I create a 'BTree!int'
by itself, it's fine. If I create a 'BTree!char' by itself, it's
fine also. But if I create both, even if they are created in
different modules, the compiler seems to mix up the types of the
function template-parameter, and tries to fit a 'char' to the
'int' function or an 'int' to the 'char' function, depending on
which was declared first.
More information about the Digitalmars-d
mailing list