[Issue 16384] New: Invariant not called with multiple defined.

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Sat Aug 13 15:26:33 PDT 2016


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

          Issue ID: 16384
           Summary: Invariant not called with multiple defined.
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P1
         Component: dmd
          Assignee: nobody at puremagic.com
          Reporter: jbc.engelen at gmail.com

The following code runs fine but shouldn't
```
struct S(T)
{
    T x = 5;
    invariant() { assert(x == 6); }
    invariant() { assert(x > 0); }

    void foo() {}
}

void main()
{
    S!int y;
    y.foo();
}
```
with `dmd -run test.d`. The first invariant on line 4 is not called in this
particular case.

--


More information about the Digitalmars-d-bugs mailing list