Bug 22153 – Non-void arrays do not match `inout void[]` arguments in implicit function template instantiation (IFTI)

Status
NEW
Severity
normal
Priority
P3
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2021-07-28T14:50:16Z
Last change time
2024-12-13T19:17:39Z
Assigned to
No Owner
Creator
Nathan S.
Moved to GitHub: dmd#18047 →

Comments

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
THIS ISSUE HAS BEEN MOVED TO GITHUB https://github.com/dlang/dmd/issues/18047 DO NOT COMMENT HERE ANYMORE, NOBODY WILL SEE IT, THIS ISSUE HAS BEEN MOVED TO GITHUB