Comment #0 by n8sh.secondary — 2021-07-28T14:50:16Z
Example:
---
size_t bytesUsed1()(const void[] array) { return array.length; }
size_t bytesUsed2()(inout void[] array) { return array.length; }
void main(string[] args)
{
// Works when required arg is const instead of inout.
auto a = args.bytesUsed1;
// Works when explicitly instantiating template.
auto b = args.bytesUsed2!();
// Works when manually converting array to void[].
auto c = (cast(void[]) args).bytesUsed2;
// Following line fails to compile:
auto d = args.bytesUsed2;
}
---
app.d(16): Error: template `app.bytesUsed2` cannot deduce function from argument types `!()(string[])`, candidates are:
app.d(2): `bytesUsed2()(inout void[] array)`
Comment #1 by robert.schadek — 2024-12-13T19:17:39Z