On Wednesday, 20 August 2014 at 16:45:49 UTC, ketmar via Digitalmars-d wrote:
On Wed, 20 Aug 2014 16:34:40 +0000
via Digitalmars-d <[email protected]> wrote:

No, the type of (cond ? x : 42) is always `int`, the `ref` already gets lost inside the ternary operator. So in this case, it behaves correctly.
it's slightly counterintuitive. yes, this is correct, but D already complains on things like (a&b == c), so it can complain on such returns
too -- just to avoid disambiguation. something like "use return
cast(int)".

What would `cast(int)` do in this case? Note that `ref` is not part of the type -- it's a storage class associated only with the variable (= parameter).

Reply via email to