Thread overview | |||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
February 27, 2023 [Issue 23744] Static If Compilation Differences / Attribute inference bug | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=23744 Iain Buclaw <ibuclaw@gdcproject.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Priority|P1 |P2 -- |
March 04, 2023 [Issue 23744] Static If Compilation Differences / Attribute inference bug | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=23744 --- Comment #1 from Bradley Chatha <bradley@chatha.dev> --- Ok, it definitely seems to be its own seperate bug: https://godbolt.org/z/xKWz1h8dT -- |
March 04, 2023 [Issue 23744] Static foreach has different behaviour inside switch statements depending on whether the body is in braces or not | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=23744 Bradley Chatha <bradley@chatha.dev> changed: What |Removed |Added ---------------------------------------------------------------------------- Summary|Static If Compilation |Static foreach has |Differences / Attribute |different behaviour inside |inference bug |switch statements depending | |on whether the body is in | |braces or not -- |
April 03, 2023 [Issue 23744] Static foreach has different behaviour inside switch statements depending on whether the body is in braces or not | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=23744 --- Comment #2 from Bradley Chatha <bradley@chatha.dev> --- After some thought and tinkering I don't think this is actually a bug but more an edgecase. ``` static if(false); ``` -- |
April 03, 2023 [Issue 23744] Static foreach has different behaviour inside switch statements depending on whether the body is in braces or not | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=23744 --- Comment #3 from Bradley Chatha <bradley@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. -- |
April 03, 2023 [Issue 23744] Bug/Edge case - Shorthand static if/foreach + case labels causes logical but unexpected behaviour | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=23744 Bradley Chatha <bradley@chatha.dev> changed: What |Removed |Added ---------------------------------------------------------------------------- Summary|Static foreach has |Bug/Edge case - Shorthand |different behaviour inside |static if/foreach + case |switch statements depending |labels causes logical but |on whether the body is in |unexpected behaviour |braces or not | -- |
April 03, 2023 [Issue 23744] Bug/Edge case - Shorthand static if/foreach + case labels causes logical but unexpected behaviour | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=23744 --- Comment #4 from Bradley Chatha <bradley@chatha.dev> --- Minimal reproduction: ``` void main() { switch(0) { static if (false) case 0: int a; a = 0; break; default: break; } } ``` I guess case labels also directly attach onto the next statement; which explains some other behaviour I've seen (namely the attached statement being omitted). -- |
Copyright © 1999-2021 by the D Language Foundation