On Sunday, April 08, 2018 16:59:35 Patrick Schluter via Digitalmars-d wrote: > On Sunday, 8 April 2018 at 16:47:59 UTC, Patrick Schluter wrote: > > 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: > >>> [...] > >> > >> To summarize: C++ works as expected and C prevents the > >> assigment because the conditional operator does not yield an > > > >> l-value: > > Exactly > > > > > > 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. > > To follow up. What's surprizing for a C guy like me is that D > accepts without problems > > (a=1)=2; > > i.e. that (a=1) is a lvalue.
I would fully expect it to be assignable, but I'm a C++ guy, not a C guy. I just tried it with both C, C++, and D though, and it does indeed fail to compile with C while it compiles perfectly fine with C++ and D. - Jonathan M Davis
