Bug 2018 – Template with a mixin doesn't work as expected
Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
x86
OS
Windows
Creation time
2008-04-20T18:26:00Z
Last change time
2015-06-09T01:14:35Z
Assigned to
bugzilla
Creator
bartosz
Comments
Comment #0 by bartosz — 2008-04-20T18:26:40Z
The following template doesn't work:
template ToType (string s)
{
mixin ("alias " ~ s ~ " ToType ;");
}
ToType!("int") x;
I had to use the following workaround:
template ToTypeHelper (string s)
{
mixin ("alias " ~ s ~ " type;");
}
template ToType (string s)
{
alias ToTypeHelper!(s).type ToType;
}