D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 19766 - Cannot pass overload set consisting solely of templated functions as alias
Summary: Cannot pass overload set consisting solely of templated functions as alias
Status: RESOLVED DUPLICATE of issue 21255
Alias: None
Product: D
Classification: Unclassified
Component: dmd (show other issues)
Version: D2
Hardware: x86_64 Linux
: P1 enhancement
Assignee: No Owner
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2019-03-27 11:57 UTC by FeepingCreature
Modified: 2021-01-02 20:40 UTC (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description FeepingCreature 2019-03-27 11:57:03 UTC
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 Boris Carvajal 2021-01-02 20:40:07 UTC

*** This issue has been marked as a duplicate of issue 21255 ***