Types A!1 and A!1u not considered equal?

David Nadlinger see at klickverbot.at
Fri Oct 21 03:30:05 PDT 2011


On 10/21/11 12:20 PM, Tobias Brandt wrote:
> Obviously, the conversion does happen implicitly, otherwise
> 'new A!1' wouldn't compile (A expects a uint as parameter).
> But then, why are A!1 and A!1u different types?

Because of a compiler bug, and contrary to the other answers, implicit 
conversion stuff is not (primarily) to blame here. I also hit it before, 
but never really had time to track it down. Sometimes (but I never 
really found out when), it also occurs if you are only using the »right« 
literals and use casts all over the place – see e.g. 
https://github.com/klickverbot/phobos/blob/units/std/units.d#L1913.

David


More information about the Digitalmars-d mailing list