static if AssignExpression

bauss jj_1337 at live.dk
Wed Feb 13 17:36:28 UTC 2019


On Wednesday, 13 February 2019 at 16:45:39 UTC, Luís Marques 
wrote:
> `static if` is defined in the D grammar as `static if ( 
> AssignExpression )`.
> What's the point of AssignExpression, instead of just a 
> ConditionalExpression?
> In what situation can you even use `static if(x = y)?`, `static 
> if(x += y)?`, etc?

I would agree with that it makes no sense that it's an 
AssignExpression.

It would've made more sense if the normal if statement was an 
AssignExpression, but even that isn't.

I don't believe there are any situations where you'd end up with 
an AssignExpression as the condition for a static if statement.

Either there is a magic reason for some compiler bug that it 
avoids OR it's a simple mistake.


More information about the Digitalmars-d mailing list