[Issue 3667] broken out(result) in contracts

d-bugmail at puremagic.com d-bugmail at puremagic.com
Tue Jan 12 13:09:13 PST 2010


http://d.puremagic.com/issues/show_bug.cgi?id=3667


Luther Tychonievich <lat7h at virginia.edu> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |lat7h at virginia.edu


--- Comment #1 from Luther Tychonievich <lat7h at virginia.edu> 2010-01-12 13:09:11 PST ---
More details: for any primitive type (all integer, character, and floating
point types, including unsigned, complex, and typedef'd varieties thereof) the
out contract's result will always be type.init.  For example, the following
code works (and shouldn't, the out contract is incorrect):
-------
typedef cdouble sometype = 4.0 + 2.0i;

sometype buggy() 
  out(result) { assert( result == 4.0 + 2.0i ); } // should fail but doesn't
  body        { return cast(sometype)0;  }

unittest { assert(buggy() == 0); }
-------

This does not happen for structs, classes, static or dynamic arrays (all seem
to function correctly).

-- 
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