TypeFunction example: ImplictConvTargets
Stefan Koch
uplink.coder at googlemail.com
Thu Oct 8 20:52:29 UTC 2020
On Wednesday, 7 October 2020 at 22:31:52 UTC, Stefan Koch wrote:
> alias type = alias;
>
> type biggestType(type[] types ...)
> {
> type result; // should initialize to Terror (The error
> type (the type that is not a type))
> // for some reason initializes to alias now?
> foreach(t; types)
> if (t.sizeof > result.sizeof) result = t;
> return result;
> }
> // working around parser issues again.
> // is expressions don't like function calls inside them ;)
> alias I(alias A) = A;
>
> pragma(msg, is(I!(biggestType()) == alias)); // prints true but
> really should not!
I just fixed this bug.
This will now print false.
the initial value of an alias variable is now ∅ The Empty type.
It's even less than void.
alias type = alias;
type TaliasInit()
{
type x;
assert(!is(x));
return x;
}
pragma(msg, TaliasInit()); // prints ∅ (Empty Type)
More information about the Digitalmars-d
mailing list