mirror of
https://github.com/dlang/phobos.git
synced 2025-04-27 13:40:20 +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)
|
||||
{
|
||||
enum hasOverloadedOpAssignWithDuration = __traits(compiles, T.init += dur!"days"(5)) &&
|
||||
is(typeof(T.init += dur!"days"(5)) == Unqual!T) &&
|
||||
__traits(compiles, T.init -= dur!"days"(5)) &&
|
||||
is(typeof(T.init -= dur!"days"(5)) == Unqual!T) &&
|
||||
__traits(compiles, T.init += TickDuration.from!"hnsecs"(5)) &&
|
||||
is(typeof(T.init += TickDuration.from!"hnsecs"(5)) == Unqual!T) &&
|
||||
__traits(compiles, T.init -= TickDuration.from!"hnsecs"(5)) &&
|
||||
is(typeof(T.init -= TickDuration.from!"hnsecs"(5)) == Unqual!T);
|
||||
enum hasOverloadedOpAssignWithDuration = is(typeof(
|
||||
{
|
||||
auto d = dur!"days"(5);
|
||||
auto td = TickDuration.from!"hnsecs"(5);
|
||||
alias U = Unqual!T;
|
||||
static assert(is(typeof(U.init += d) == U));
|
||||
static assert(is(typeof(U.init -= d) == U));
|
||||
static assert(is(typeof(U.init += td) == U));
|
||||
static assert(is(typeof(U.init -= td) == U));
|
||||
}));
|
||||
}
|
||||
|
||||
unittest
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue