Thread overview
[Issue 11080] assert(`string`) should be forbidden
Apr 02, 2015
Ketmar Dark
Dec 17, 2022
Iain Buclaw
Sep 01, 2023
Nick Treleaven
Jan 26, 2024
Nick Treleaven
April 02, 2015
https://issues.dlang.org/show_bug.cgi?id=11080

--- Comment #28 from Ketmar Dark <ketmar@ketmar.no-ip.org> ---
Created attachment 1505
  --> https://issues.dlang.org/attachment.cgi?id=1505&action=edit
don't accept string as condition in `assert` and `static assert`

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

Iain Buclaw <ibuclaw@gdcproject.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Priority|P2                          |P4

--
September 01, 2023
https://issues.dlang.org/show_bug.cgi?id=11080

Nick Treleaven <nick@geany.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |nick@geany.org

--- Comment #29 from Nick Treleaven <nick@geany.org> ---
Firstly, issue #4733 is WONTFIX (AIUI due to `if (auto a = array_expr)` being
not nice to rewrite).

Detecting a string literal first argument to assert is still possible. Relying on a linter to detect this means most people won't detect it as they don't run linters.

At DConf 2023, Walter actually had a slide with this bug in it. On the slide 'Positives are self evident' about `version` statements, he had:

`else static assert("unsupported");`

Which always passes. I think that settles the 'how common is this bug?' debate.

--
January 26, 2024
https://issues.dlang.org/show_bug.cgi?id=11080

Nick Treleaven <nick@geany.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|REOPENED                    |RESOLVED
         Resolution|---                         |DUPLICATE

--- Comment #30 from Nick Treleaven <nick@geany.org> ---
Issue 14387 was filed later but that got the PR, so marking this as a duplicate.

*** This issue has been marked as a duplicate of issue 14387 ***

--