Bug 19766 – Cannot pass overload set consisting solely of templated functions as alias
Status
RESOLVED
Resolution
DUPLICATE
Severity
enhancement
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
x86_64
OS
Linux
Creation time
2019-03-27T11:57:03Z
Last change time
2021-01-02T20:40:07Z
Assigned to
No Owner
Creator
FeepingCreature
Comments
Comment #0 by default_357-line — 2019-03-27T11:57:03Z
Consider the following code:
// void foo(int) { }
void foo(T : int)(T) { }
void bar(T : string)(T) { }
void baz(T : bool)(T) { }
alias a = foo;
alias a = bar;
alias a = baz;
void test(alias fn)()
{
fn(0);
fn(null);
fn(true);
}
void main() {
test!a();
}
Result:
onlineapp.d: Error: overload alias `onlineapp.a` forward declaration
If `foo` is a function, as per the comment, I can pass `a` as an overload set to `test()`, even though the other two functions in the set are templated. However, since `foo` is also a template, I get an inexplicable error message.
Comment #1 by boris2.9 — 2021-01-02T20:40:07Z
*** This issue has been marked as a duplicate of issue 21255 ***