Is there any reason why arithmetic operation on shorts and bytes return int?
Jonathan M Davis
jmdavisProg at gmx.com
Wed Dec 12 10:25:43 PST 2012
On Wednesday, December 12, 2012 10:42:31 Simen Kjaeraas wrote:
> Really? This certainly does not compile for me:
>
>
> struct bbyte {
> byte b;
> alias b this;
> }
>
> void bar(bbyte b) {}
>
> bbyte baz() {
> byte b;
> return b; // cannot implicitly convert expression (b) of type byte to
> bbyte
> }
>
> void main() {
> byte b;
> bar(b); // function bar (bbyte b) is not callable using argument types
> (byte)
> }
>
>
> This is also the reason for bug #8570
>
> http://d.puremagic.com/issues/show_bug.cgi?id=8570
If alias this isn't do an implict conversion, then there's a bug in alias
this. That's how implict conversion is done in D, and it's the whole point
of alias this.
- Jonathan M Davis
More information about the Digitalmars-d
mailing list