mirror of
https://github.com/dlang/phobos.git
synced 2025-04-28 22:21:09 +03:00
Merge pull request #959 from 9rnsr/fix9046
Issue 9046 - typeof(T.init) should have the type T
This commit is contained in:
commit
45f23d90f1
1 changed files with 10 additions and 8 deletions
|
@ -33037,14 +33037,16 @@ unittest
|
||||||
+/
|
+/
|
||||||
template hasOverloadedOpAssignWithDuration(T)
|
template hasOverloadedOpAssignWithDuration(T)
|
||||||
{
|
{
|
||||||
enum hasOverloadedOpAssignWithDuration = __traits(compiles, T.init += dur!"days"(5)) &&
|
enum hasOverloadedOpAssignWithDuration = is(typeof(
|
||||||
is(typeof(T.init += dur!"days"(5)) == Unqual!T) &&
|
{
|
||||||
__traits(compiles, T.init -= dur!"days"(5)) &&
|
auto d = dur!"days"(5);
|
||||||
is(typeof(T.init -= dur!"days"(5)) == Unqual!T) &&
|
auto td = TickDuration.from!"hnsecs"(5);
|
||||||
__traits(compiles, T.init += TickDuration.from!"hnsecs"(5)) &&
|
alias U = Unqual!T;
|
||||||
is(typeof(T.init += TickDuration.from!"hnsecs"(5)) == Unqual!T) &&
|
static assert(is(typeof(U.init += d) == U));
|
||||||
__traits(compiles, T.init -= TickDuration.from!"hnsecs"(5)) &&
|
static assert(is(typeof(U.init -= d) == U));
|
||||||
is(typeof(T.init -= TickDuration.from!"hnsecs"(5)) == Unqual!T);
|
static assert(is(typeof(U.init += td) == U));
|
||||||
|
static assert(is(typeof(U.init -= td) == U));
|
||||||
|
}));
|
||||||
}
|
}
|
||||||
|
|
||||||
unittest
|
unittest
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue