[Issue 12901] New: `in`/`out` contracts on struct constructor must require function body

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Thu Jun 12 23:07:50 PDT 2014


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

          Issue ID: 12901
           Summary: `in`/`out` contracts on struct constructor must
                    require function body
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: major
          Priority: P1
         Component: DMD
          Assignee: nobody at puremagic.com
          Reporter: verylonglogin.reg at gmail.com

This code must not compile:
---
struct S
{
    int a;

    this(int n)
    in // or `out`
    { a = n; }
}

void main()
{
    assert(S(5).a == 5); // will be false with `-release`
}
---

This issue is a source of nasty release-only bugs.

--


More information about the Digitalmars-d-bugs mailing list