mirror of
https://github.com/dlang/phobos.git
synced 2025-05-03 08:30:33 +03:00
Fix12596 - Implement Typedef ctor that can take itself as the parameter.
This commit is contained in:
parent
9579b42cc5
commit
c69d2959e8
1 changed files with 13 additions and 0 deletions
|
@ -4234,6 +4234,11 @@ struct Typedef(T, T init, string cookie=null)
|
|||
Typedef_payload = init;
|
||||
}
|
||||
|
||||
this(Typedef tdef)
|
||||
{
|
||||
this(tdef.Typedef_payload);
|
||||
}
|
||||
|
||||
mixin Proxy!Typedef_payload;
|
||||
}
|
||||
|
||||
|
@ -4317,6 +4322,14 @@ unittest
|
|||
}
|
||||
}
|
||||
|
||||
unittest // Issue 12596
|
||||
{
|
||||
import std.typecons;
|
||||
alias TD = Typedef!int;
|
||||
TD x = TD(1);
|
||||
TD y = TD(x);
|
||||
assert(x == y);
|
||||
}
|
||||
|
||||
/**
|
||||
Allocates a $(D class) object right inside the current scope,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue