Fix hasType!T when called with rvalues.
This commit is contained in:
parent
47800db273
commit
de7df6bfeb
|
@ -611,6 +611,11 @@ bool hasType(T, U)(in ref TaggedAlgebraic!U ta)
|
|||
}
|
||||
assert(false); // never reached
|
||||
}
|
||||
/// ditto
|
||||
bool hasType(T, U)(in TaggedAlgebraic!U ta)
|
||||
{
|
||||
return hasType!(T, U)(ta);
|
||||
}
|
||||
|
||||
///
|
||||
unittest {
|
||||
|
@ -641,6 +646,18 @@ unittest { // issue #1
|
|||
assert(ta.hasType!int);
|
||||
}
|
||||
|
||||
unittest {
|
||||
union U {
|
||||
int a;
|
||||
float b;
|
||||
}
|
||||
alias TA = TaggedAlgebraic!U;
|
||||
|
||||
const(TA) test() { return TA(12); }
|
||||
assert(test().hasType!int);
|
||||
}
|
||||
|
||||
|
||||
/** Gets the value stored in an algebraic type based on its data type.
|
||||
*/
|
||||
ref inout(T) get(T, U)(ref inout(TaggedAlgebraic!U) ta)
|
||||
|
|
Loading…
Reference in a new issue