Binary operation on typedefs

Zarathustra adam.chrapkowski at gmail.com
Tue Dec 15 15:45:35 PST 2009


Do you think is it bug?

typedef uint A;
typedef A    B;

const A a1 = cast(A)0x01;
const A a2 = cast(A)0x02;

const B b1 = cast(B)0x04;
const B b2 = cast(B)0x04;

const A a3 = a1 | a2; // great it's ok (a1, a2, a3 same type)
const A a4 = b1; // great it's ok (b1 is delivered from A)
const A a5 = a1 | b1; // ERROR, but why?

In my opinion result of a1 and b1 shoud be A type not uint.



More information about the Digitalmars-d mailing list