Thread overview
[Issue 22067] importC: cast-expression accepted as lvalue in assignment-expression
Jun 22, 2021
Iain Buclaw
Jun 22, 2021
Iain Buclaw
Jun 22, 2021
Iain Buclaw
Jun 22, 2021
Iain Buclaw
Jun 22, 2021
Dlang Bot
Jun 24, 2021
Dlang Bot
June 22, 2021
https://issues.dlang.org/show_bug.cgi?id=22067

Iain Buclaw <ibuclaw@gdcproject.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |accepts-invalid, ImportC
                 CC|                            |ibuclaw@gdcproject.org

--
June 22, 2021
https://issues.dlang.org/show_bug.cgi?id=22067

--- Comment #1 from Iain Buclaw <ibuclaw@gdcproject.org> ---
DMD accepts any conditional expression on the LHS and diagnose the invalid lvalue rather than producing a syntax error.

So the issue is that this isn't detected during semantic, unlike issue 22068 (though we could also move that to semantic too to for a consistent error message).

--
June 22, 2021
https://issues.dlang.org/show_bug.cgi?id=22067

--- Comment #2 from Iain Buclaw <ibuclaw@gdcproject.org> ---
Actually, the list of valid lvalues in C is so simple, we can do a first pass in the parser without having to go through semantic.

- CompoundLiteralExp
- StringExp
- PtrExp
- ArrayExp
- IdentifierExp
- DotIdExp (if e1 is an lvalue)

--
June 22, 2021
https://issues.dlang.org/show_bug.cgi?id=22067

--- Comment #3 from Iain Buclaw <ibuclaw@gdcproject.org> ---
(In reply to Iain Buclaw from comment #2)
> Actually, the list of valid lvalues in C is so simple, we can do a first pass in the parser without having to go through semantic.
Semantic can deal with more complicated matters, such as const.

--
June 22, 2021
https://issues.dlang.org/show_bug.cgi?id=22067

Dlang Bot <dlang-bot@dlang.rocks> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |pull

--- Comment #4 from Dlang Bot <dlang-bot@dlang.rocks> ---
@ibuclaw created dlang/dmd pull request #12736 "fix Issue 22067 - importC: cast-expression accepted as lvalue in assignment-expression" fixing this issue:

- fix Issue 22067 - importC: cast-expression accepted as lvalue in assignment-expression

https://github.com/dlang/dmd/pull/12736

--
June 24, 2021
https://issues.dlang.org/show_bug.cgi?id=22067

Dlang Bot <dlang-bot@dlang.rocks> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|---                         |FIXED

--- Comment #5 from Dlang Bot <dlang-bot@dlang.rocks> ---
dlang/dmd pull request #12736 "fix Issue 22067 - importC: cast-expression accepted as lvalue in assignment-expression" was merged into master:

- 41b50c9eebc999a9b28d8301cb2e2c79e806559c by Iain Buclaw:
  fix Issue 22067 - importC: cast-expression accepted as lvalue in
assignment-expression

https://github.com/dlang/dmd/pull/12736

--