If Statement with Declaration
Nick Treleaven via Digitalmars-d
digitalmars-d at puremagic.com
Mon Jul 24 06:34:33 PDT 2017
On Monday, 24 July 2017 at 13:12:17 UTC, Nick Treleaven wrote:
> static if (is(E == enum; alias V)) { // this inserts "V"
> V v;
> }
>
> The test comes first as it logically should, as the alias is
> not being used until the following statement.
Hmm, it can be used in the test:
is(Abc U : U*)
is(AA A : A[B], B : int)
is(AA T : T[U], U : const char[])
So the alias part would come first instead:
is(alias U; Abc : U*)
is(alias A; AA : A[B], B : int)
is(alias T; AA : T[U], U : const char[])
Note: The spec page needs to use CamelCase for types (abc -> Abc,
bar -> Bar), especially as the construct is difficult to read
anyway. Maybe I'll do this soon. (I think other parts of the spec
contravene this too).
More information about the Digitalmars-d
mailing list