On Monday, 31 August 2015 at 07:08:20 UTC, Jacob Carlborg wrote:
On 2015-08-31 08:01, Martin Nowak wrote:
First beta for the 2.068.1 point release (we skipped -b1 due to a bug).


I started compile my projects with DMD 2.068.0 (yes, I know I'm a bit late). I noted that this piece of code that compiles in 2.067.0 doesn't compile in 2.068.0 (or 2.068.1-b2) :

class Foo
{
    override string toString()
    in { }
    body
    {
        return "foo";
    }
}

The error message I get is:

main.d(3): Error: function main.Foo.toString cannot have an in contract when overriden function object.Object.toString does not have an in contract

The above code is a minimal testcase extracted from Tango.

The question is, is this a regression or expected? I suspect it's expected. The check was added four years ago, although I don't understand why it hasn't been hit before.

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

- Kenji

Reply via email to