[Issue 21078] static if(is(T IDENT)) introduces IDENT beyond static if's scpe

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sun Jul 26 10:56:46 UTC 2020


https://issues.dlang.org/show_bug.cgi?id=21078

ag0aep6g <ag0aep6g at gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |ag0aep6g at gmail.com

--- Comment #1 from ag0aep6g <ag0aep6g at gmail.com> ---
(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:
> 
> https://dlang.org/spec/expression.html#IsExpression
> 
> 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.

--


More information about the Digitalmars-d-bugs mailing list