Bug 10231 – Spec: Document typed alias parameter feature
Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P2
Component
dlang.org
Product
D
Version
D2
Platform
All
OS
All
Creation time
2013-06-01T13:54:00Z
Last change time
2014-04-23T00:12:55Z
Keywords
pull, spec
Assigned to
andrej.mitrovich
Creator
andrej.mitrovich
Comments
Comment #0 by andrej.mitrovich — 2013-06-01T13:54:22Z
Recently Kenji mentioned that the following works:
-----
struct X(alias int x)
{
}
void main()
{
int i;
alias X!i IVal; // ok
float f;
alias X!f FVal; // fail
}
-----
Even if this is allowed by the current syntax rules, it is largely an undocumented feature (compiler implementers could easily miss this feature as well). It should be properly documented.
Comment #1 by maxim — 2013-06-01T14:35:49Z
By the way, it seems it does not support implicit type conversions.
Comment #2 by andrej.mitrovich — 2013-06-01T14:37:18Z
(In reply to comment #1)
> By the way, it seems it does not support implicit type conversions.
For that I think I'd like this enhancement to work:
-----
struct X(alias T x, T : int)
{
}
void main()
{
short i;
alias X!i IVal;
}
-----
Comment #3 by andrej.mitrovich — 2014-04-22T22:57:29Z