Bug 12596 – Implement Typedef ctor that can take itself as a parameter
Status
RESOLVED
Resolution
FIXED
Severity
enhancement
Priority
P1
Component
phobos
Product
D
Version
D2
Platform
All
OS
All
Creation time
2014-04-19T09:11:00Z
Last change time
2014-04-23T20:29:54Z
Keywords
pull
Assigned to
andrej.mitrovich
Creator
bearophile_hugs
Comments
Comment #0 by bearophile_hugs — 2014-04-19T09:11:00Z
void main() {
import std.typecons;
alias TD = Typedef!double;
TD x = TD(1.0);
TD y = TD(x); // Error
}
DMD 2.066alpha gives:
test.d(5,16): Error: constructor std.typecons.Typedef!(double, nan).Typedef.this (double init) is not callable using argument types (Typedef!(double, nan))
But I think "TD(x)" should be accepted, just like:
void main() {
auto x = double(1);
auto y = double(x);
}