Thread overview
[Issue 21078] static if(is(T IDENT)) introduces IDENT beyond static if's scpe
Jul 26
Jul 28
July 26

ag0aep6g <> changed:

           What    |Removed                     |Added
                 CC|                            |

--- Comment #1 from ag0aep6g <> ---
(In reply to Adam D. Ruppe from comment #0)
> And this is bizarre. If you do
>         bool o = is(float FLOAT);
> outside the static if btw you get:
> Error: can only declare type aliases within static if conditionals or tatic asserts
> The spec is not clear on this. It says:
> is ( Type Identifier )
> The condition is satisfied if Type is semantically correct. If so,
> Identifier is declared to be an alias of Type.

The spec is quite clear on this (third paragraph):

"The Identifier forms can only be used if the IsExpression appears in a StaticIfCondition."

Not saying that that rule makes any sense, but it's there.

July 26

--- Comment #2 from Adam D. Ruppe <> ---
> The spec is quite clear on this (third paragraph):

My English is sloppy, by "this" I mean the extent of the scope, that it would survive INT outside the static if (I edited in the other thing later and forgot to clarify).

The FLOAT one is defined, but the INT one is the one I care about anyway.

July 28

--- Comment #3 from Basile-z <> ---
One thing is that it is specified `static if` doesn't introduce a "logical" scope also there's one in the syntax, so "lexicographically" (let's call this like that)

void main() {
    static if(is(int INT))
    { // <-- lexical scope but not "logical"
        INT a;
    INT b;