Thread overview
[Issue 24025] Expressions contained in parentheses should not be assumed to be C casts
Jul 03, 2023
Dlang Bot
Jul 04, 2023
Dlang Bot
Jul 16, 2023
Nick Treleaven
July 02, 2023
https://issues.dlang.org/show_bug.cgi?id=24025

--- Comment #1 from Steven Schveighoffer <schveiguy@gmail.com> ---
An alternative to delaying the C style cast to semantic is to just remove the error.

If a cast from C is desired, then it will work if the type can be constructed with that parameter.

Back when this error was created, something like `int(5)` was not valid code. Now it is. So most cases of casting will just have a failed implicit cast error.

Ironically, this error *hurts* porting C code, instead of helping.

--
July 03, 2023
https://issues.dlang.org/show_bug.cgi?id=24025

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

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

--- Comment #2 from Dlang Bot <dlang-bot@dlang.rocks> ---
@ntrel created dlang/dmd pull request #15377 "Fix Issue 24025 - Expressions contained in parentheses should not be …" fixing this issue:

- Fix Issue 24025 - Expressions contained in parentheses should not be assumed to be C casts

  Allow `(identifier)` and `(BasicType)` when followed by a left parenthesis.
  These can be a function call or an implicit conversion - the latter may
  produce a semantic error (not a parse error).

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

--
July 04, 2023
https://issues.dlang.org/show_bug.cgi?id=24025

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

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

--- Comment #3 from Dlang Bot <dlang-bot@dlang.rocks> ---
dlang/dmd pull request #15377 "Fix Issue 24025 - Expressions contained in parentheses should not be …" was merged into master:

- 9f782c456e31a4fad5027961d64c346d388f1b7e by Nick Treleaven:
  Fix Issue 24025 - Expressions contained in parentheses should not be assumed
to be C casts

  Allow `(identifier)` and `(BasicType)` when followed by a left parenthesis.
  These can be a function call or an implicit conversion - the latter may
  produce a semantic error (not a parse error).

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

--
July 16, 2023
https://issues.dlang.org/show_bug.cgi?id=24025

Nick Treleaven <nick@geany.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |Ajieskola@gmail.com

--- Comment #4 from Nick Treleaven <nick@geany.org> ---
*** Issue 22217 has been marked as a duplicate of this issue. ***

--