This code:
==========
module scratch;
class C {
int x;
invariant() {
assert( x < int.max );
}
auto foo() {
return x;
}
}
=========
Reports this error:
$ dmd scratch.d
scratch.d(10): Error: function scratch.C.foo post conditions are not supported if the return type is inferred
Removing the invariant eliminates the error message. Converting the 'auto' to an explicit return type eliminates the error message.
Given that the compiler must eventually figure out the return type of the method, I have no idea why this error is occurring.