On Sunday, 8 April 2018 at 10:03:33 UTC, kdevel wrote:
On Sunday, 8 April 2018 at 07:22:19 UTC, Patrick Schluter wrote:
You may find an in-depth discussion of the C++ case in
My formulation was ambiguous, it is the same precedence as the
link says. The link also says that's it's right to left
evaluation. This means that for expression:
a ? b = c : d = e;
right to left evaluation will make the = e assignment higher
priority than the b = c assignment or the ternary even if they
have the same priority level.
To summarize: C++ works as expected and C prevents the
assigment because the conditional operator does not yield an
Now, the only thing is to clearly define what it is in D, as
apparently it is neither the C++ nor the C behaviour. The old
precedence table on the D wiki seems to say it is like C, but the
example of that thread seems to show it's not.