[Issue 11488] Disallow chaining of - operator

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Sun Feb 1 13:44:47 PST 2015


https://issues.dlang.org/show_bug.cgi?id=11488

--- Comment #7 from Stewart Gordon <smjg at iname.com> ---
(In reply to Iain Buclaw from comment #6)
> It looks like the grammar does allow this, but fails semantic because in the
> following expression, -x is not an lvalue (probably an implementation detail
> though).
> 
> -- -x;

For primitive types, this should never pass.  However, it's potentially
possible for it to work on struct/class objects that have this overloaded.  But
even then, such a long-winded example as Manfred posted is highly unlikely to
find its way into real-world code.

--


More information about the Digitalmars-d-bugs mailing list