Bug 22720 – Overload of template and alias to template instantiation that is also a template fails

Status
NEW
Severity
normal
Priority
P3
Component
dmd
Product
D
Version
D2
Platform
x86_64
OS
Linux
Creation time
2022-01-31T15:34:27Z
Last change time
2024-12-13T19:20:43Z
Assigned to
No Owner
Creator
FeepingCreature
Moved to GitHub: dmd#20046 →

Comments

Comment #0 by default_357-line — 2022-01-31T15:34:27Z
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`.
Comment #1 by johanengelen — 2022-08-03T21:39:17Z
Comment #2 by johanengelen — 2022-08-03T21:39:57Z
(In reply to johanengelen from comment #1) > https://d.godbolt.org/z/ErfTTvj1n Apologies, wrong bug report. Perhaps this bug is related to https://issues.dlang.org/show_bug.cgi?id=23281.
Comment #3 by robert.schadek — 2024-12-13T19:20:43Z
THIS ISSUE HAS BEEN MOVED TO GITHUB https://github.com/dlang/dmd/issues/20046 DO NOT COMMENT HERE ANYMORE, NOBODY WILL SEE IT, THIS ISSUE HAS BEEN MOVED TO GITHUB