Thread overview
[Issue 23266] Dead else blocks are not considered unreachable
Jul 22, 2022
FeepingCreature
Jul 22, 2022
FeepingCreature
Dec 17, 2022
Iain Buclaw
Nov 14, 2023
FeepingCreature
July 22, 2022
https://issues.dlang.org/show_bug.cgi?id=23266

--- Comment #1 from FeepingCreature <default_357-line@yahoo.de> ---
One could argue that this is correct because otherwise the common technique of stubbing out an if statement by adding `if (false &&` stops working. For the CompoundStatement error to trigger with that, you'd need to do `if (true &&`, which is much more rare.

--
July 22, 2022
https://issues.dlang.org/show_bug.cgi?id=23266

--- Comment #2 from FeepingCreature <default_357-line@yahoo.de> ---
I've tried a DMD branch that errors with -w if `if()` has a statically known true condition and an else block. The two main things I ran into in Phobos are:

1.
if (false) {
  some code that should affect function attributes but never be run;
}

2.
if (...) that should be static if (...)

For one the warning is useful, for the other it's harmful...

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

Iain Buclaw <ibuclaw@gdcproject.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Priority|P1                          |P4

--
November 14, 2023
https://issues.dlang.org/show_bug.cgi?id=23266

Steven Schveighoffer <schveiguy@gmail.com> changed:

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

--- Comment #3 from Steven Schveighoffer <schveiguy@gmail.com> ---
The unreachable code warning will be disabled in the next release of the compiler.

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

I suggest we close this. WONTFIX? There's no MOOT status!

--
November 14, 2023
https://issues.dlang.org/show_bug.cgi?id=23266

FeepingCreature <default_357-line@yahoo.de> changed:

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

--- Comment #4 from FeepingCreature <default_357-line@yahoo.de> ---
GOODEND

--