[Issue 22613] New: Alias to template instantiation can act as the template itself
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Mon Dec 20 11:49:12 UTC 2021
https://issues.dlang.org/show_bug.cgi?id=22613
Issue ID: 22613
Summary: Alias to template instantiation can act as the
template itself
Product: D
Version: D2
Hardware: x86_64
OS: Linux
Status: NEW
Severity: normal
Priority: P1
Component: dmd
Assignee: nobody at puremagic.com
Reporter: hagai at weka.io
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.
--
More information about the Digitalmars-d-bugs
mailing list