Comment #0 by john.loughran.colvin — 2013-08-22T15:05:22Z
import std.typecons;
alias Typedef!(void*) VP;
void main()
{
VP vp;
assert(vp is null); //won't compile
}
Error: incompatible types for ((vp) is (null)): 'Typedef!(void*, null)' and 'typeof(null)'
Comment #1 by andrej.mitrovich — 2013-08-22T15:09:02Z
I'm not sure how we could implement this, we don't have an "opIs" operator.
Comment #2 by john.loughran.colvin — 2013-08-22T15:17:08Z
(In reply to comment #1)
> I'm not sure how we could implement this, we don't have an "opIs" operator.
yeah I have no idea either.
Is there any other way of getting something like a type-safe alias?
Comment #3 by bugzilla — 2019-11-14T14:34:16Z
I don't think that we can do here something.
Instead of assert(vp is null) you could use assert(cast(TypedefType!VP) vp is null), but I don't know, if that is, what you are looking for.