www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 12901] New: `in`/`out` contracts on struct constructor must

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 puremagic.com
          Reporter: verylonglogin.reg 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.

--
Jun 12 2014