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


Shin Fujishiro <rsi...@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |rsi...@gmail.com


--- Comment #2 from Shin Fujishiro <rsi...@gmail.com> 2010-10-16 12:02:06 PDT 
---
It's undocumented, but struct invariants are fired on pointers:
--------------------
struct S
{
    invariant() { assert(0); }  // (3)
}
void main()
{
    S s;
    assert(&s);
}
--------------------
% dmd -run test.d
core.exception.asserter...@test(3): Assertion failure
--------------------

Though it's non-intuitive, I find it reasonable considering that structs can
define opCast to bool.  assert(s) would be ambiguous if s had both invariant
and opCast!bool.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------

Reply via email to