[Issue 23576] New: Better Error Message When Forgetting To Pass A Template Parameter
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Fri Dec 23 18:55:21 UTC 2022
https://issues.dlang.org/show_bug.cgi?id=23576
Issue ID: 23576
Summary: Better Error Message When Forgetting To Pass A
Template Parameter
Product: D
Version: D2
Hardware: All
OS: All
Status: NEW
Severity: enhancement
Priority: P1
Component: dmd
Assignee: nobody at puremagic.com
Reporter: jack at jackstouffer.com
Current Behavior
Consider the following program
import std;
void test1(uint id, uint __)
{
int x = 0;
}
void test2(C)(uint id)
{
int x = 0;
}
void main()
{
uint a = 0;
test1(a);
test2(a);
}
For test1, DMD gives a good error message:
onlineapp.d(16): Error: function `onlineapp.test1(uint id, uint __)` is not
callable using argument types `(uint)`
onlineapp.d(16): missing argument for parameter #2: `uint __`
This tells the user exactly what's wrong. Great! On the other hand, the test2
error message isn't as helpful
onlineapp.d(17): Error: none of the overloads of template `onlineapp.test2` are
callable using argument types `!()(uint)`
onlineapp.d(8): Candidate is: `test2(C)(uint id)`
Expected Behavior:
The error message should be something like
onlineapp.d(16): Error: function `onlineapp.test2(C)(uint id)` is not callable
using argument types `(uint)`
onlineapp.d(16): missing argument for template parameter #1: `C`
--
More information about the Digitalmars-d-bugs
mailing list