Bug 22613 – Alias to template instantiation can act as the template itself

Status
NEW
Severity
normal
Priority
P3
Component
dmd
Product
D
Version
D2
Platform
x86_64
OS
Linux
Creation time
2021-12-20T11:49:12Z
Last change time
2024-12-13T19:19:57Z
Assigned to
No Owner
Creator
Hagai
Moved to GitHub: dmd#20025 →

Comments

Comment #0 by hagai — 2021-12-20T11:49:12Z
Example: ``` enum foo(int x) = x; alias bar = foo!1; pragma(msg, bar); // prints 1 pragma(msg, bar!2); // prints 2 ``` `bar` is an alias to instantiated template (an `int` value), yet surprisingly it can also act as the template itself, and be re-instantiated. I'd expect the expression `bar!2` to produce a compilation error.
Comment #1 by robert.schadek — 2024-12-13T19:19:57Z
THIS ISSUE HAS BEEN MOVED TO GITHUB https://github.com/dlang/dmd/issues/20025 DO NOT COMMENT HERE ANYMORE, NOBODY WILL SEE IT, THIS ISSUE HAS BEEN MOVED TO GITHUB