www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 23678] New: Contracts are compiled with release switch?

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

          Issue ID: 23678
           Summary: Contracts are compiled with release switch?
           Product: D
           Version: D2
          Hardware: x86_64
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: chalucha gmail.com

Test case:

```D
version (assert) int foo;

void test()
in (!foo)
{}

void main() {
    test();
}
```

When built with `-release`, `foo` is not compiled in and compilation fails
with:

```
Error: undefined identifier `foo`
```

Should't the contract be dropped too in release builds?

--
Feb 07 2023