www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 16384] New: Invariant not called with multiple defined.

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 puremagic.com
          Reporter: jbc.engelen 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.

--
Aug 13 2016