[Issue 19766] New: Cannot pass overload set consisting solely of templated functions as alias
    d-bugmail at puremagic.com 
    d-bugmail at puremagic.com
       
    Wed Mar 27 11:57:03 UTC 2019
    
    
  
https://issues.dlang.org/show_bug.cgi?id=19766
          Issue ID: 19766
           Summary: Cannot pass overload set consisting solely of
                    templated functions as alias
           Product: D
           Version: D2
          Hardware: x86_64
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P1
         Component: dmd
          Assignee: nobody at puremagic.com
          Reporter: default_357-line at yahoo.de
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.
--
    
    
More information about the Digitalmars-d-bugs
mailing list