Bug 24831 – IFTI fails for a function template with a default function argument

Status
NEW
Severity
normal
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
x86_64
OS
All
Creation time
2024-10-24T07:01:34Z
Last change time
2024-12-13T19:38:16Z
Keywords
rejects-valid
Assigned to
No Owner
Creator
Max Samukha
See also
https://issues.dlang.org/show_bug.cgi?id=21917
Moved to GitHub: dmd#20537 →

Comments

Comment #0 by maxsamukha — 2024-10-24T07:01:34Z
This renders default arguments in generic functions unusable. void foo(U, T = int)(T v = T.init) { } void main() { foo!int(); // ok foo!int("x"); // fail } Error: function `foo` is not callable using argument types `(string)` The second call tries to reuse the previous instantiation instead of creating a new one. An explicit instantiation works but defeats the purpose of using default arguments.
Comment #1 by robert.schadek — 2024-12-13T19:38:16Z
THIS ISSUE HAS BEEN MOVED TO GITHUB https://github.com/dlang/dmd/issues/20537 DO NOT COMMENT HERE ANYMORE, NOBODY WILL SEE IT, THIS ISSUE HAS BEEN MOVED TO GITHUB