auto ref deduction and common type deduction inconsistency

ketmar via Digitalmars-d digitalmars-d at puremagic.com
Wed Aug 20 09:45:39 PDT 2014


On Wed, 20 Aug 2014 16:34:40 +0000
via Digitalmars-d <digitalmars-d at puremagic.com> 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)".
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 181 bytes
Desc: not available
URL: <http://lists.puremagic.com/pipermail/digitalmars-d/attachments/20140820/9ae045bb/attachment.sig>


More information about the Digitalmars-d mailing list