digitalmars.D.bugs - [Issue 22720] New: Overload of template and alias to template
- d-bugmail puremagic.com (35/35) Jan 31 2022 https://issues.dlang.org/show_bug.cgi?id=22720
https://issues.dlang.org/show_bug.cgi?id=22720 Issue ID: 22720 Summary: Overload of template and alias to template instantiation that is also a template fails Product: D Version: D2 Hardware: x86_64 OS: Linux Status: NEW Severity: normal Priority: P1 Component: dmd Assignee: nobody puremagic.com Reporter: default_357-line yahoo.de Consider the following code: ``` template foo(T) { U foo(U : T)() { return T.init; } } float bar(U : float)() { return 0.0f; } alias bar = foo!int; void main() { assert(bar!int == 0); } ``` Ie. template function bar is overloaded with an alias to foo's instance foo!int, which is itself a template function. This results in: onlineapp.d(6): Error: template instance `foo!int` `foo!int` forward references template declaration `foo(T)` onlineapp.d(6): Error: alias `onlineapp.bar` conflicts with template `onlineapp.bar(U : float)()` at onlineapp.d(5) Note that this works fine if foo is just a function, or if `alias bar` is moved before `float bar`. --
Jan 31 2022