[Issue 7386] Can't use a 'version' that was set inside 'static if'

d-bugmail at puremagic.com d-bugmail at puremagic.com
Mon Apr 11 11:44:22 UTC 2022


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

--- Comment #5 from Iain Buclaw <ibuclaw at gdcproject.org> ---
Potentially very breaking, but declaring versions could be even more
restrictive than it currently is.

i.e: When setting a version in a function or user defined type, you expect a
compile-time error.

    Error: version `Foo` declaration must be at module level

This could be extended to `static if` as well so that we avoid all these nasty
cases of will it, won't it work.  Also noting that it's currently an error to
declare a version inside a `static foreach`.

---
static foreach (_; 0 .. 5) {
    version = Foo;  // Error: version `Foo` declaration must be at module level
}
---

So why is `static if` different here?

--


More information about the Digitalmars-d-bugs mailing list