Bug 16384 – Invariant not called with multiple defined.
Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P3
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2016-08-13T22:26:33Z
Last change time
2023-06-01T03:09:56Z
Keywords
pull
Assigned to
No Owner
Creator
Johan Engelen
Comments
Comment #0 by jbc.engelen — 2016-08-13T22:26:33Z
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.
Comment #1 by dlang-bot — 2023-05-30T10:22:10Z
@RazvanN7 created dlang/dmd pull request #15280 "Fix Issue 16384 - Invariant not called with multiple defined." fixing this issue:
- Fix Issue 16384 - Invariant not called with multiple defined.
https://github.com/dlang/dmd/pull/15280
Comment #2 by dlang-bot — 2023-06-01T03:09:56Z
dlang/dmd pull request #15280 "Fix Issue 16384 - Invariant not called with multiple defined." was merged into master:
- 4de548ffa9bda74e5fece5f56ba3f9d9cc879201 by RazvanN7:
Fix Issue 16384 - Invariant not called with multiple defined.
https://github.com/dlang/dmd/pull/15280