Compiler reports an error for Foo1.foo, but not for Foo2.foo.
class Obj1
{
string foo() { return ""; }
}
class Obj2
{
string foo();
}
class Foo1 : Obj1
{
// Error: function test.Foo1.foo cannot have an in contract
// when overriden function test.Obj1.foo does not have an in contract
override string foo()
in { }
body
{
return "foo";
}
}
class Foo2 : Obj2
{
// no error
override string foo()
in { }
body
{
return "foo";
}
}
----
The original mention is here:
http://forum.dlang.org/post/[email protected]
With 2.067.x, following code had worked without any errors, but with 2.068.1, it makes an error.
class Foo
{
override string toString()
in { }
body
{
return "foo";
}
}
That's introduced by the druntime change that to directly use object.d than object.di file.
Comment #1 by doob — 2015-09-01T06:29:52Z
I wouldn't say the in-contract is pointless, it's a minimal test case. The original code of course has code in the in-contract.
Comment #3 by dlang-bugzilla — 2015-09-01T12:15:38Z
(In reply to Kenji Hara from comment #0)
> Compiler reports an error for Foo1.foo, but not for Foo2.foo.
FWIW - before DMD commit 0ab7722db17351cc8db67f54f36cdb85387bd1d7, the code compiled successfully.
Comment #4 by dlang-bugzilla — 2015-09-01T12:16:34Z