Bug 18609 – `is` expression identifier accessible outside `static if`

Status
RESOLVED
Resolution
WONTFIX
Severity
normal
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
x86
OS
Windows
Creation time
2018-03-14T14:34:14Z
Last change time
2023-07-13T15:39:31Z
Keywords
accepts-invalid
Assigned to
No Owner
Creator
Nick Treleaven

Comments

Comment #0 by nick — 2018-03-14T14:34:14Z
static if (is(int W)) { } pragma(msg, W); // ok with dmd v2.079.0 `W` should only be visible inside the `static if`.
Comment #1 by petar.p.kirov — 2018-08-21T17:50:31Z
`static if` doesn't create a scope, so I think the current behavior is correct, though a bit suprising.
Comment #2 by razvan.nitu1305 — 2022-02-25T10:51:52Z
Yes, the behavior is correct. Static if does not introduce a scope so it is only natural that W can be seen from outside the static if scope.
Comment #3 by nick — 2023-07-13T15:39:31Z
*** Issue 21078 has been marked as a duplicate of this issue. ***