[Issue 19669] New: There is no way for code to detect whether -dip1000 is enabled or not

d-bugmail at puremagic.com d-bugmail at puremagic.com
Mon Feb 11 18:16:39 UTC 2019


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

          Issue ID: 19669
           Summary: There is no way for code to detect whether -dip1000 is
                    enabled or not
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: major
          Priority: P1
         Component: dmd
          Assignee: nobody at puremagic.com
          Reporter: monkeyworks12 at hotmail.com

Currently, there is no way for code to tell whether the -dip1000 switch has
been passed to the compiler. This makes it harder to write code that needs to
do something different depending on whether dip1000 is in effect or not, and in
my opinion, is REQUIRED for any non-trivial code base that wants/has to support
legacy compiler versions.

There is a hacky workaround:

static assert(!__traits(compiles, {
    char[] f()
    {
        char[2] x;
        return x[].splitterASCII!(_ => _ == ' ').front;
    }
}));

But it would be far preferable to be able to use `version(dip1000)` or `static
if (dip1000)`.

--


More information about the Digitalmars-d-bugs mailing list