[Issue 15731] Analysis error on explicit case fall-through
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Thu Nov 3 10:22:18 UTC 2022
https://issues.dlang.org/show_bug.cgi?id=15731
Dennis <dkorpel at live.nl> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|RESOLVED |REOPENED
CC| |dkorpel at live.nl
Resolution|WORKSFORME |---
--- Comment #6 from Dennis <dkorpel at live.nl> ---
(In reply to RazvanN from comment #5)
> When compiling the initial example I get:
>
> test.d(18): Error: switch case fallthrough - use 'goto case;' if intended
>
>
> This seems to have been fixed
The problem is that with -version=bad, it incorrectly raises an error about
missing a return statement or assert(0). That's still the case.
Here's a reduced example:
```
// accepts valid
int a()
{
while (1)
{
switch (0)
{
case 0: // < implicit fallthrough
default: continue;
}
}
}
// rejects valid
int b()
{
while (1)
{
switch (0)
{
case 0: goto default; // < explicit fallthrough
default: continue;
}
}
}
```
--
More information about the Digitalmars-d-bugs
mailing list