Thread overview
[Issue 23064] wrong code generated for bitfield assignment to ?:
Apr 27, 2022
Walter Bright
Apr 28, 2022
Basile-z
Apr 28, 2022
Basile-z
Apr 30, 2022
Walter Bright
Dec 17, 2022
Iain Buclaw
April 27, 2022
https://issues.dlang.org/show_bug.cgi?id=23064

Walter Bright <bugzilla@digitalmars.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |ImportC

--
April 28, 2022
https://issues.dlang.org/show_bug.cgi?id=23064

Basile-z <b2.temp@gmx.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |b2.temp@gmx.com

--- Comment #1 from Basile-z <b2.temp@gmx.com> ---
After a brief discussion on IRC it seems that C does not allow the conditional expression to be a lvalue, hence it could not be an assignment RHS.

>From http://www.open-std.org/jtc1/sc22/wg14/www/docs/n1548.pdf

---
 The first operand is evaluated; there is a sequence point between its
evaluation and the
evaluation of the second or third operand (whichever is evaluated). The second
operand
is evaluated only if the first compares unequal to 0; the third operand is
evaluated only if
the first compares equal to 0; the result is the value of the second or third
operand
(whichever is evaluated), converted to the type described below.110)

[...]

110) A conditional expression does not yield an lvalue
---

that would not affect ImportC then.

--
April 28, 2022
https://issues.dlang.org/show_bug.cgi?id=23064

--- Comment #2 from Basile-z <b2.temp@gmx.com> ---
> expression to be a lvalue, hence it could not be an assignment RHS.

sorry I meant LHS obviously

--
April 30, 2022
https://issues.dlang.org/show_bug.cgi?id=23064

--- Comment #3 from Walter Bright <bugzilla@digitalmars.com> ---
You are correct that C doesn't allow it.

Currently, D accepts it and generates the wrong code.

C++ accepts it, and generates the correct code.

We should either make it an error or do what C++ does.

--
December 17, 2022
https://issues.dlang.org/show_bug.cgi?id=23064

Iain Buclaw <ibuclaw@gdcproject.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Priority|P1                          |P3

--
December 13
https://issues.dlang.org/show_bug.cgi?id=23064

--- Comment #4 from dlangBugzillaToGithub <robert.schadek@posteo.de> ---
THIS ISSUE HAS BEEN MOVED TO GITHUB

https://github.com/dlang/dmd/issues/18101

DO NOT COMMENT HERE ANYMORE, NOBODY WILL SEE IT, THIS ISSUE HAS BEEN MOVED TO GITHUB

--