[Issue 23744] Static foreach has different behaviour inside switch statements depending on whether the body is in braces or not

d-bugmail at puremagic.com d-bugmail at puremagic.com
Mon Apr 3 07:20:15 UTC 2023


https://issues.dlang.org/show_bug.cgi?id=23744

--- Comment #3 from Bradley Chatha <bradley at chatha.dev> ---
Apologies, I forget using tab in a browser text editor is generally unwise :D

Anyway:


```
static if(false)
   case 0:
      yada...
      break; 
```

The static if (also works for static foreach) only attached itself to the
resulting `case 0:` AST Node; leaving the 'body' of the case in some strange
limbo state, causing semantic errors.

Which fully explains some of the weirdness displayed, especially why brackets
removes the issue.

--


More information about the Digitalmars-d-bugs mailing list