Bug 24135 – Eponymous template member overloads not shown as call candidates
Status
RESOLVED
Resolution
FIXED
Severity
enhancement
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
x86_64
OS
Linux
Creation time
2023-09-04T13:37:32Z
Last change time
2024-05-31T23:47:25Z
Keywords
diagnostic, pull
Assigned to
No Owner
Creator
Nick Treleaven
Comments
Comment #0 by nick — 2023-09-04T13:37:32Z
The following code tries to call 2 eponymous templates with incorrect arguments:
template skipOver(alias pred = (a, b) => a == b)
{
bool skipOver(Haystack, Needles...)(ref Haystack haystack, Needles needles) => true;
bool skipOver(R)(ref R r1) => true;
bool skipOver(R, Es...)(ref R r, Es es) => true;
}
void main()
{
skipOver();
t2();
}
template t2(T)
{
bool t2(string);
bool t2(int[]);
bool t2(R)(R);
}
dmd gives:
onemember_overloads.d(29): Error: none of the overloads of template `onemember_overloads.skipOver` are callable using argument types `!()()`
onemember_overloads.d(18): Candidate is: `skipOver(alias pred = (a, b) => a == b)`
onemember_overloads.d(30): Error: none of the overloads of template `onemember_overloads.t2` are callable using argument types `!()()`
onemember_overloads.d(33): Candidate is: `t2(T)(string)`
The error messages only show the first internal overload of each template declaration when they should each list the 3 members.
PR incoming.
Comment #1 by nick — 2023-09-04T13:39:34Z
> The error messages only show the first internal overload of each template declaration
BTW that only applies to t2, for skipOver only the parent template is shown.
Comment #2 by dlang-bot — 2023-09-04T13:48:42Z
@ntrel updated dlang/dmd pull request #15572 "Fix Issue 24135 - Eponymous template member overloads not shown as call candidates" fixing this issue:
- Fix Issue 24135 - Eponymous template member overloads not shown as call candidates
https://github.com/dlang/dmd/pull/15572
Comment #3 by dlang-bot — 2024-05-31T23:47:25Z
dlang/dmd pull request #15572 "Fix Issue 24135 - Eponymous template member overloads not shown as call candidates" was merged into master:
- dff4ad01b6e6c13284153e3a9b20fffb10a3e6da by Nick Treleaven:
Fix Bugzilla 24135 - Eponymous template member overloads not shown as call candidates
https://github.com/dlang/dmd/pull/15572