[Issue 18558] New: Template alias spec incomplete
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Mon Mar 5 15:45:19 UTC 2018
https://issues.dlang.org/show_bug.cgi?id=18558
Issue ID: 18558
Summary: Template alias spec incomplete
Product: D
Version: D2
Hardware: All
OS: All
Status: NEW
Severity: normal
Priority: P1
Component: dlang.org
Assignee: nobody at puremagic.com
Reporter: johnnymarler at gmail.com
https://dlang.org/spec/template.html#TemplateAliasParameter
[Copied from spec]
Alias parameters enable templates to be parameterized with almost any kind of D
symbol, including user-defined type names, global names, local names, module
names, template names, and template instance names. Literals can also be used
as arguments to alias parameters.
I've found that you can also pass function calls, i.e.
----------------------------
template Foo(alias x)
{
enum Foo = x;
}
size_t return42() { return 42; }
void main()
{
auto foo2 = Foo!(return42());
pragma(msg, typeof(foo2).stringof);
}
----------------------------
The spec should be updated to describe the true capabilities of alias template
parameters. It sounds like along with symbols and literals, alias parameters
can also accept compile-time values.
--
More information about the Digitalmars-d-bugs
mailing list