[Issue 5039] New: Cannot use invariant() with auto methods
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Mon Oct 11 01:05:09 PDT 2010
http://d.puremagic.com/issues/show_bug.cgi?id=5039
Summary: Cannot use invariant() with auto methods
Product: D
Version: D2
Platform: x86
OS/Version: Windows
Status: NEW
Severity: minor
Priority: P2
Component: DMD
AssignedTo: nobody at puremagic.com
ReportedBy: ah08010-d at yahoo.com
--- Comment #0 from Austin Hastings <ah08010-d at yahoo.com> 2010-10-11 01:04:38 PDT ---
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.
--
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
More information about the Digitalmars-d-bugs
mailing list