compiler/libec: Fixed reference issue with conversion properties
[sdk] / compiler / bootstrap / libec / bootstrap / pass15.c
index 40e3d1b..940b311 100644 (file)
@@ -182,6 +182,8 @@ extern const char *  sourceFile;
 
 extern struct __ecereNameSpace__ecere__com__Property * __ecereProp_Type_specConst;
 
+unsigned int reachedPass15;
+
 extern unsigned int memoryGuard;
 
 struct __ecereNameSpace__ecere__sys__OldList
@@ -536,7 +538,7 @@ char * PrintUShort(unsigned short result)
 {
 char temp[100];
 
-if(result > (unsigned short)32767)
+if(result > 32767)
 sprintf(temp, "0x%X", (int)result);
 else
 sprintf(temp, "%d", (int)result);
@@ -555,9 +557,9 @@ char * PrintChar(char result)
 {
 char temp[100];
 
-if(result > (char)0 && isprint(result))
+if(result > 0 && isprint(result))
 sprintf(temp, "'%c'", result);
-else if(result < (char)0)
+else if(result < 0)
 sprintf(temp, "%d", (int)result);
 else
 sprintf(temp, "0x%X", (unsigned char)result);
@@ -643,12 +645,12 @@ extern void FreeExpression(struct Expression * exp);
 
 extern void FreeExpContents(struct Expression * exp);
 
+extern struct Expression * GetNonBracketsExp(struct Expression * exp);
+
 extern struct Expression * CopyExpression(struct Expression * exp);
 
 extern struct Expression * MkExpBrackets(struct __ecereNameSpace__ecere__sys__OldList * expressions);
 
-extern struct Expression * GetNonBracketsExp(struct Expression * exp);
-
 extern struct Expression * MkExpCall(struct Expression * expression, struct __ecereNameSpace__ecere__sys__OldList * arguments);
 
 extern struct Expression * MkExpCondition(struct Expression * cond, struct __ecereNameSpace__ecere__sys__OldList * expressions, struct Expression * elseExp);
@@ -1825,11 +1827,13 @@ unsigned int size;
 char *  name;
 char *  typeName;
 struct __ecereNameSpace__ecere__com__Class * thisClassFrom;
+int promotedFrom;
 int classObjectType;
 int alignment;
 unsigned int offset;
 int bitFieldCount;
 int count;
+int bitMemberSize;
 unsigned int isSigned : 1;
 unsigned int constant : 1;
 unsigned int truth : 1;
@@ -1846,6 +1850,7 @@ unsigned int typedByReference : 1;
 unsigned int casted : 1;
 unsigned int pointerAlignment : 1;
 unsigned int isLong : 1;
+unsigned int signedBeforePromotion : 1;
 } ecere_gcc_struct;
 
 struct Specifier
@@ -2525,7 +2530,7 @@ static unsigned int ShortAdd(struct Expression * exp, struct Operand * op1, stru
 short value2 = op2->__anon1.s;
 
 exp->type = 2;
-exp->__anon1.__anon2.string = PrintShort((op1->__anon1.s + value2));
+exp->__anon1.__anon2.string = PrintShort((short)(op1->__anon1.s + value2));
 if(!exp->expType)
 {
 exp->expType = op1->type;
@@ -2540,7 +2545,7 @@ static unsigned int UShortAdd(struct Expression * exp, struct Operand * op1, str
 unsigned short value2 = op2->__anon1.us;
 
 exp->type = 2;
-exp->__anon1.__anon2.string = PrintUShort((op1->__anon1.us + value2));
+exp->__anon1.__anon2.string = PrintUShort((unsigned short)(op1->__anon1.us + value2));
 if(!exp->expType)
 {
 exp->expType = op1->type;
@@ -2555,7 +2560,7 @@ static unsigned int CharAdd(struct Expression * exp, struct Operand * op1, struc
 char value2 = op2->__anon1.c;
 
 exp->type = 2;
-exp->__anon1.__anon2.string = PrintChar((op1->__anon1.c + value2));
+exp->__anon1.__anon2.string = PrintChar((char)(op1->__anon1.c + value2));
 if(!exp->expType)
 {
 exp->expType = op1->type;
@@ -2570,7 +2575,7 @@ static unsigned int UCharAdd(struct Expression * exp, struct Operand * op1, stru
 unsigned char value2 = op2->__anon1.uc;
 
 exp->type = 2;
-exp->__anon1.__anon2.string = PrintUChar((op1->__anon1.uc + value2));
+exp->__anon1.__anon2.string = PrintUChar((unsigned char)(op1->__anon1.uc + value2));
 if(!exp->expType)
 {
 exp->expType = op1->type;
@@ -2675,7 +2680,7 @@ static unsigned int ShortSub(struct Expression * exp, struct Operand * op1, stru
 short value2 = op2->__anon1.s;
 
 exp->type = 2;
-exp->__anon1.__anon2.string = PrintShort((op1->__anon1.s - value2));
+exp->__anon1.__anon2.string = PrintShort((short)(op1->__anon1.s - value2));
 if(!exp->expType)
 {
 exp->expType = op1->type;
@@ -2690,7 +2695,7 @@ static unsigned int UShortSub(struct Expression * exp, struct Operand * op1, str
 unsigned short value2 = op2->__anon1.us;
 
 exp->type = 2;
-exp->__anon1.__anon2.string = PrintUShort((op1->__anon1.us - value2));
+exp->__anon1.__anon2.string = PrintUShort((unsigned short)(op1->__anon1.us - value2));
 if(!exp->expType)
 {
 exp->expType = op1->type;
@@ -2705,7 +2710,7 @@ static unsigned int CharSub(struct Expression * exp, struct Operand * op1, struc
 char value2 = op2->__anon1.c;
 
 exp->type = 2;
-exp->__anon1.__anon2.string = PrintChar((op1->__anon1.c - value2));
+exp->__anon1.__anon2.string = PrintChar((char)(op1->__anon1.c - value2));
 if(!exp->expType)
 {
 exp->expType = op1->type;
@@ -2720,7 +2725,7 @@ static unsigned int UCharSub(struct Expression * exp, struct Operand * op1, stru
 unsigned char value2 = op2->__anon1.uc;
 
 exp->type = 2;
-exp->__anon1.__anon2.string = PrintUChar((op1->__anon1.uc - value2));
+exp->__anon1.__anon2.string = PrintUChar((unsigned char)(op1->__anon1.uc - value2));
 if(!exp->expType)
 {
 exp->expType = op1->type;
@@ -2825,7 +2830,7 @@ static unsigned int ShortMul(struct Expression * exp, struct Operand * op1, stru
 short value2 = op2->__anon1.s;
 
 exp->type = 2;
-exp->__anon1.__anon2.string = PrintShort((op1->__anon1.s * value2));
+exp->__anon1.__anon2.string = PrintShort((short)(op1->__anon1.s * value2));
 if(!exp->expType)
 {
 exp->expType = op1->type;
@@ -2840,7 +2845,7 @@ static unsigned int UShortMul(struct Expression * exp, struct Operand * op1, str
 unsigned short value2 = op2->__anon1.us;
 
 exp->type = 2;
-exp->__anon1.__anon2.string = PrintUShort((op1->__anon1.us * value2));
+exp->__anon1.__anon2.string = PrintUShort((unsigned short)(op1->__anon1.us * value2));
 if(!exp->expType)
 {
 exp->expType = op1->type;
@@ -2855,7 +2860,7 @@ static unsigned int CharMul(struct Expression * exp, struct Operand * op1, struc
 char value2 = op2->__anon1.c;
 
 exp->type = 2;
-exp->__anon1.__anon2.string = PrintChar((op1->__anon1.c * value2));
+exp->__anon1.__anon2.string = PrintChar((char)(op1->__anon1.c * value2));
 if(!exp->expType)
 {
 exp->expType = op1->type;
@@ -2870,7 +2875,7 @@ static unsigned int UCharMul(struct Expression * exp, struct Operand * op1, stru
 unsigned char value2 = op2->__anon1.uc;
 
 exp->type = 2;
-exp->__anon1.__anon2.string = PrintUChar((op1->__anon1.uc * value2));
+exp->__anon1.__anon2.string = PrintUChar((unsigned char)(op1->__anon1.uc * value2));
 if(!exp->expType)
 {
 exp->expType = op1->type;
@@ -2915,7 +2920,7 @@ static unsigned int IntDiv(struct Expression * exp, struct Operand * op1, struct
 int value2 = op2->__anon1.i;
 
 exp->type = 2;
-exp->__anon1.__anon2.string = PrintInt(value2 ? (op1->__anon1.i / value2) : 0);
+exp->__anon1.__anon2.string = PrintInt(value2 ? ((op1->__anon1.i / value2)) : 0);
 if(!exp->expType)
 {
 exp->expType = op1->type;
@@ -2930,7 +2935,7 @@ static unsigned int UIntDiv(struct Expression * exp, struct Operand * op1, struc
 unsigned int value2 = op2->__anon1.ui;
 
 exp->type = 2;
-exp->__anon1.__anon2.string = PrintUInt(value2 ? (op1->__anon1.ui / value2) : 0);
+exp->__anon1.__anon2.string = PrintUInt(value2 ? ((op1->__anon1.ui / value2)) : 0);
 if(!exp->expType)
 {
 exp->expType = op1->type;
@@ -2945,7 +2950,7 @@ static unsigned int Int64Div(struct Expression * exp, struct Operand * op1, stru
 long long value2 = op2->__anon1.i64;
 
 exp->type = 2;
-exp->__anon1.__anon2.string = PrintInt64(value2 ? (op1->__anon1.i64 / value2) : 0);
+exp->__anon1.__anon2.string = PrintInt64(value2 ? ((op1->__anon1.i64 / value2)) : 0);
 if(!exp->expType)
 {
 exp->expType = op1->type;
@@ -2960,7 +2965,7 @@ static unsigned int UInt64Div(struct Expression * exp, struct Operand * op1, str
 uint64 value2 = op2->__anon1.ui64;
 
 exp->type = 2;
-exp->__anon1.__anon2.string = PrintUInt64(value2 ? (op1->__anon1.ui64 / value2) : 0);
+exp->__anon1.__anon2.string = PrintUInt64(value2 ? ((op1->__anon1.ui64 / value2)) : 0);
 if(!exp->expType)
 {
 exp->expType = op1->type;
@@ -2975,7 +2980,7 @@ static unsigned int ShortDiv(struct Expression * exp, struct Operand * op1, stru
 short value2 = op2->__anon1.s;
 
 exp->type = 2;
-exp->__anon1.__anon2.string = PrintShort(value2 ? (op1->__anon1.s / value2) : (short)0);
+exp->__anon1.__anon2.string = PrintShort(value2 ? ((short)(op1->__anon1.s / value2)) : 0);
 if(!exp->expType)
 {
 exp->expType = op1->type;
@@ -2990,7 +2995,7 @@ static unsigned int UShortDiv(struct Expression * exp, struct Operand * op1, str
 unsigned short value2 = op2->__anon1.us;
 
 exp->type = 2;
-exp->__anon1.__anon2.string = PrintUShort(value2 ? (op1->__anon1.us / value2) : (unsigned short)0);
+exp->__anon1.__anon2.string = PrintUShort(value2 ? ((unsigned short)(op1->__anon1.us / value2)) : 0);
 if(!exp->expType)
 {
 exp->expType = op1->type;
@@ -3005,7 +3010,7 @@ static unsigned int CharDiv(struct Expression * exp, struct Operand * op1, struc
 char value2 = op2->__anon1.c;
 
 exp->type = 2;
-exp->__anon1.__anon2.string = PrintChar(value2 ? (op1->__anon1.c / value2) : (char)0);
+exp->__anon1.__anon2.string = PrintChar(value2 ? ((char)(op1->__anon1.c / value2)) : 0);
 if(!exp->expType)
 {
 exp->expType = op1->type;
@@ -3020,7 +3025,7 @@ static unsigned int UCharDiv(struct Expression * exp, struct Operand * op1, stru
 unsigned char value2 = op2->__anon1.uc;
 
 exp->type = 2;
-exp->__anon1.__anon2.string = PrintUChar(value2 ? (op1->__anon1.uc / value2) : (unsigned char)0);
+exp->__anon1.__anon2.string = PrintUChar(value2 ? ((unsigned char)(op1->__anon1.uc / value2)) : 0);
 if(!exp->expType)
 {
 exp->expType = op1->type;
@@ -3035,7 +3040,7 @@ static unsigned int FloatDiv(struct Expression * exp, struct Operand * op1, stru
 float value2 = op2->__anon1.f;
 
 exp->type = 2;
-exp->__anon1.__anon2.string = PrintFloat(op1->__anon1.f / value2);
+exp->__anon1.__anon2.string = PrintFloat((float)(op1->__anon1.f / value2));
 if(!exp->expType)
 {
 exp->expType = op1->type;
@@ -3050,7 +3055,7 @@ static unsigned int DoubleDiv(struct Expression * exp, struct Operand * op1, str
 double value2 = op2->__anon1.d;
 
 exp->type = 2;
-exp->__anon1.__anon2.string = PrintDouble(op1->__anon1.d / value2);
+exp->__anon1.__anon2.string = PrintDouble((double)(op1->__anon1.d / value2));
 if(!exp->expType)
 {
 exp->expType = op1->type;
@@ -3065,7 +3070,7 @@ static unsigned int IntMod(struct Expression * exp, struct Operand * op1, struct
 int value2 = op2->__anon1.i;
 
 exp->type = 2;
-exp->__anon1.__anon2.string = PrintInt(value2 ? (op1->__anon1.i % value2) : 0);
+exp->__anon1.__anon2.string = PrintInt(value2 ? ((op1->__anon1.i % value2)) : 0);
 if(!exp->expType)
 {
 exp->expType = op1->type;
@@ -3080,7 +3085,7 @@ static unsigned int UIntMod(struct Expression * exp, struct Operand * op1, struc
 unsigned int value2 = op2->__anon1.ui;
 
 exp->type = 2;
-exp->__anon1.__anon2.string = PrintUInt(value2 ? (op1->__anon1.ui % value2) : 0);
+exp->__anon1.__anon2.string = PrintUInt(value2 ? ((op1->__anon1.ui % value2)) : 0);
 if(!exp->expType)
 {
 exp->expType = op1->type;
@@ -3095,7 +3100,7 @@ static unsigned int Int64Mod(struct Expression * exp, struct Operand * op1, stru
 long long value2 = op2->__anon1.i64;
 
 exp->type = 2;
-exp->__anon1.__anon2.string = PrintInt64(value2 ? (op1->__anon1.i64 % value2) : 0);
+exp->__anon1.__anon2.string = PrintInt64(value2 ? ((op1->__anon1.i64 % value2)) : 0);
 if(!exp->expType)
 {
 exp->expType = op1->type;
@@ -3110,7 +3115,7 @@ static unsigned int UInt64Mod(struct Expression * exp, struct Operand * op1, str
 uint64 value2 = op2->__anon1.ui64;
 
 exp->type = 2;
-exp->__anon1.__anon2.string = PrintUInt64(value2 ? (op1->__anon1.ui64 % value2) : 0);
+exp->__anon1.__anon2.string = PrintUInt64(value2 ? ((op1->__anon1.ui64 % value2)) : 0);
 if(!exp->expType)
 {
 exp->expType = op1->type;
@@ -3125,7 +3130,7 @@ static unsigned int ShortMod(struct Expression * exp, struct Operand * op1, stru
 short value2 = op2->__anon1.s;
 
 exp->type = 2;
-exp->__anon1.__anon2.string = PrintShort(value2 ? (op1->__anon1.s % value2) : (short)0);
+exp->__anon1.__anon2.string = PrintShort(value2 ? ((short)(op1->__anon1.s % value2)) : 0);
 if(!exp->expType)
 {
 exp->expType = op1->type;
@@ -3140,7 +3145,7 @@ static unsigned int UShortMod(struct Expression * exp, struct Operand * op1, str
 unsigned short value2 = op2->__anon1.us;
 
 exp->type = 2;
-exp->__anon1.__anon2.string = PrintUShort(value2 ? (op1->__anon1.us % value2) : (unsigned short)0);
+exp->__anon1.__anon2.string = PrintUShort(value2 ? ((unsigned short)(op1->__anon1.us % value2)) : 0);
 if(!exp->expType)
 {
 exp->expType = op1->type;
@@ -3155,7 +3160,7 @@ static unsigned int CharMod(struct Expression * exp, struct Operand * op1, struc
 char value2 = op2->__anon1.c;
 
 exp->type = 2;
-exp->__anon1.__anon2.string = PrintChar(value2 ? (op1->__anon1.c % value2) : (char)0);
+exp->__anon1.__anon2.string = PrintChar(value2 ? ((char)(op1->__anon1.c % value2)) : 0);
 if(!exp->expType)
 {
 exp->expType = op1->type;
@@ -3170,7 +3175,7 @@ static unsigned int UCharMod(struct Expression * exp, struct Operand * op1, stru
 unsigned char value2 = op2->__anon1.uc;
 
 exp->type = 2;
-exp->__anon1.__anon2.string = PrintUChar(value2 ? (op1->__anon1.uc % value2) : (unsigned char)0);
+exp->__anon1.__anon2.string = PrintUChar(value2 ? ((unsigned char)(op1->__anon1.uc % value2)) : 0);
 if(!exp->expType)
 {
 exp->expType = op1->type;
@@ -4175,7 +4180,7 @@ static unsigned int IntDivAsign(struct Expression * exp, struct Operand * op1, s
 int value2 = op2->__anon1.i;
 
 exp->type = 2;
-exp->__anon1.__anon2.string = PrintInt(value2 ? (op1->__anon1.i /= value2) : 0);
+exp->__anon1.__anon2.string = PrintInt(value2 ? ((op1->__anon1.i /= value2)) : 0);
 if(!exp->expType)
 {
 exp->expType = op1->type;
@@ -4190,7 +4195,7 @@ static unsigned int UIntDivAsign(struct Expression * exp, struct Operand * op1,
 unsigned int value2 = op2->__anon1.ui;
 
 exp->type = 2;
-exp->__anon1.__anon2.string = PrintUInt(value2 ? (op1->__anon1.ui /= value2) : 0);
+exp->__anon1.__anon2.string = PrintUInt(value2 ? ((op1->__anon1.ui /= value2)) : 0);
 if(!exp->expType)
 {
 exp->expType = op1->type;
@@ -4205,7 +4210,7 @@ static unsigned int Int64DivAsign(struct Expression * exp, struct Operand * op1,
 long long value2 = op2->__anon1.i64;
 
 exp->type = 2;
-exp->__anon1.__anon2.string = PrintInt64(value2 ? (op1->__anon1.i64 /= value2) : 0);
+exp->__anon1.__anon2.string = PrintInt64(value2 ? ((op1->__anon1.i64 /= value2)) : 0);
 if(!exp->expType)
 {
 exp->expType = op1->type;
@@ -4220,7 +4225,7 @@ static unsigned int UInt64DivAsign(struct Expression * exp, struct Operand * op1
 uint64 value2 = op2->__anon1.ui64;
 
 exp->type = 2;
-exp->__anon1.__anon2.string = PrintUInt64(value2 ? (op1->__anon1.ui64 /= value2) : 0);
+exp->__anon1.__anon2.string = PrintUInt64(value2 ? ((op1->__anon1.ui64 /= value2)) : 0);
 if(!exp->expType)
 {
 exp->expType = op1->type;
@@ -4235,7 +4240,7 @@ static unsigned int ShortDivAsign(struct Expression * exp, struct Operand * op1,
 short value2 = op2->__anon1.s;
 
 exp->type = 2;
-exp->__anon1.__anon2.string = PrintShort(value2 ? (op1->__anon1.s /= value2) : (short)0);
+exp->__anon1.__anon2.string = PrintShort(value2 ? ((op1->__anon1.s /= value2)) : 0);
 if(!exp->expType)
 {
 exp->expType = op1->type;
@@ -4250,7 +4255,7 @@ static unsigned int UShortDivAsign(struct Expression * exp, struct Operand * op1
 unsigned short value2 = op2->__anon1.us;
 
 exp->type = 2;
-exp->__anon1.__anon2.string = PrintUShort(value2 ? (op1->__anon1.us /= value2) : (unsigned short)0);
+exp->__anon1.__anon2.string = PrintUShort(value2 ? ((op1->__anon1.us /= value2)) : 0);
 if(!exp->expType)
 {
 exp->expType = op1->type;
@@ -4265,7 +4270,7 @@ static unsigned int CharDivAsign(struct Expression * exp, struct Operand * op1,
 char value2 = op2->__anon1.c;
 
 exp->type = 2;
-exp->__anon1.__anon2.string = PrintChar(value2 ? (op1->__anon1.c /= value2) : (char)0);
+exp->__anon1.__anon2.string = PrintChar(value2 ? ((op1->__anon1.c /= value2)) : 0);
 if(!exp->expType)
 {
 exp->expType = op1->type;
@@ -4280,7 +4285,7 @@ static unsigned int UCharDivAsign(struct Expression * exp, struct Operand * op1,
 unsigned char value2 = op2->__anon1.uc;
 
 exp->type = 2;
-exp->__anon1.__anon2.string = PrintUChar(value2 ? (op1->__anon1.uc /= value2) : (unsigned char)0);
+exp->__anon1.__anon2.string = PrintUChar(value2 ? ((op1->__anon1.uc /= value2)) : 0);
 if(!exp->expType)
 {
 exp->expType = op1->type;
@@ -4295,7 +4300,7 @@ static unsigned int FloatDivAsign(struct Expression * exp, struct Operand * op1,
 float value2 = op2->__anon1.f;
 
 exp->type = 2;
-exp->__anon1.__anon2.string = PrintFloat(op1->__anon1.f /= value2);
+exp->__anon1.__anon2.string = PrintFloat((float)(op1->__anon1.f /= value2));
 if(!exp->expType)
 {
 exp->expType = op1->type;
@@ -4310,7 +4315,7 @@ static unsigned int DoubleDivAsign(struct Expression * exp, struct Operand * op1
 double value2 = op2->__anon1.d;
 
 exp->type = 2;
-exp->__anon1.__anon2.string = PrintDouble(op1->__anon1.d /= value2);
+exp->__anon1.__anon2.string = PrintDouble((double)(op1->__anon1.d /= value2));
 if(!exp->expType)
 {
 exp->expType = op1->type;
@@ -4325,7 +4330,7 @@ static unsigned int IntModAsign(struct Expression * exp, struct Operand * op1, s
 int value2 = op2->__anon1.i;
 
 exp->type = 2;
-exp->__anon1.__anon2.string = PrintInt(value2 ? (op1->__anon1.i %= value2) : 0);
+exp->__anon1.__anon2.string = PrintInt(value2 ? ((op1->__anon1.i %= value2)) : 0);
 if(!exp->expType)
 {
 exp->expType = op1->type;
@@ -4340,7 +4345,7 @@ static unsigned int UIntModAsign(struct Expression * exp, struct Operand * op1,
 unsigned int value2 = op2->__anon1.ui;
 
 exp->type = 2;
-exp->__anon1.__anon2.string = PrintUInt(value2 ? (op1->__anon1.ui %= value2) : 0);
+exp->__anon1.__anon2.string = PrintUInt(value2 ? ((op1->__anon1.ui %= value2)) : 0);
 if(!exp->expType)
 {
 exp->expType = op1->type;
@@ -4355,7 +4360,7 @@ static unsigned int Int64ModAsign(struct Expression * exp, struct Operand * op1,
 long long value2 = op2->__anon1.i64;
 
 exp->type = 2;
-exp->__anon1.__anon2.string = PrintInt64(value2 ? (op1->__anon1.i64 %= value2) : 0);
+exp->__anon1.__anon2.string = PrintInt64(value2 ? ((op1->__anon1.i64 %= value2)) : 0);
 if(!exp->expType)
 {
 exp->expType = op1->type;
@@ -4370,7 +4375,7 @@ static unsigned int UInt64ModAsign(struct Expression * exp, struct Operand * op1
 uint64 value2 = op2->__anon1.ui64;
 
 exp->type = 2;
-exp->__anon1.__anon2.string = PrintUInt64(value2 ? (op1->__anon1.ui64 %= value2) : 0);
+exp->__anon1.__anon2.string = PrintUInt64(value2 ? ((op1->__anon1.ui64 %= value2)) : 0);
 if(!exp->expType)
 {
 exp->expType = op1->type;
@@ -4385,7 +4390,7 @@ static unsigned int ShortModAsign(struct Expression * exp, struct Operand * op1,
 short value2 = op2->__anon1.s;
 
 exp->type = 2;
-exp->__anon1.__anon2.string = PrintShort(value2 ? (op1->__anon1.s %= value2) : (short)0);
+exp->__anon1.__anon2.string = PrintShort(value2 ? ((op1->__anon1.s %= value2)) : 0);
 if(!exp->expType)
 {
 exp->expType = op1->type;
@@ -4400,7 +4405,7 @@ static unsigned int UShortModAsign(struct Expression * exp, struct Operand * op1
 unsigned short value2 = op2->__anon1.us;
 
 exp->type = 2;
-exp->__anon1.__anon2.string = PrintUShort(value2 ? (op1->__anon1.us %= value2) : (unsigned short)0);
+exp->__anon1.__anon2.string = PrintUShort(value2 ? ((op1->__anon1.us %= value2)) : 0);
 if(!exp->expType)
 {
 exp->expType = op1->type;
@@ -4415,7 +4420,7 @@ static unsigned int CharModAsign(struct Expression * exp, struct Operand * op1,
 char value2 = op2->__anon1.c;
 
 exp->type = 2;
-exp->__anon1.__anon2.string = PrintChar(value2 ? (op1->__anon1.c %= value2) : (char)0);
+exp->__anon1.__anon2.string = PrintChar(value2 ? ((op1->__anon1.c %= value2)) : 0);
 if(!exp->expType)
 {
 exp->expType = op1->type;
@@ -4430,7 +4435,7 @@ static unsigned int UCharModAsign(struct Expression * exp, struct Operand * op1,
 unsigned char value2 = op2->__anon1.uc;
 
 exp->type = 2;
-exp->__anon1.__anon2.string = PrintUChar(value2 ? (op1->__anon1.uc %= value2) : (unsigned char)0);
+exp->__anon1.__anon2.string = PrintUChar(value2 ? ((op1->__anon1.uc %= value2)) : 0);
 if(!exp->expType)
 {
 exp->expType = op1->type;
@@ -4505,7 +4510,7 @@ static unsigned int ShortBitAnd(struct Expression * exp, struct Operand * op1, s
 short value2 = op2->__anon1.s;
 
 exp->type = 2;
-exp->__anon1.__anon2.string = PrintShort((op1->__anon1.s & value2));
+exp->__anon1.__anon2.string = PrintShort((short)(op1->__anon1.s & value2));
 if(!exp->expType)
 {
 exp->expType = op1->type;
@@ -4520,7 +4525,7 @@ static unsigned int UShortBitAnd(struct Expression * exp, struct Operand * op1,
 unsigned short value2 = op2->__anon1.us;
 
 exp->type = 2;
-exp->__anon1.__anon2.string = PrintUShort((op1->__anon1.us & value2));
+exp->__anon1.__anon2.string = PrintUShort((unsigned short)(op1->__anon1.us & value2));
 if(!exp->expType)
 {
 exp->expType = op1->type;
@@ -4535,7 +4540,7 @@ static unsigned int CharBitAnd(struct Expression * exp, struct Operand * op1, st
 char value2 = op2->__anon1.c;
 
 exp->type = 2;
-exp->__anon1.__anon2.string = PrintChar((op1->__anon1.c & value2));
+exp->__anon1.__anon2.string = PrintChar((char)(op1->__anon1.c & value2));
 if(!exp->expType)
 {
 exp->expType = op1->type;
@@ -4550,7 +4555,7 @@ static unsigned int UCharBitAnd(struct Expression * exp, struct Operand * op1, s
 unsigned char value2 = op2->__anon1.uc;
 
 exp->type = 2;
-exp->__anon1.__anon2.string = PrintUChar((op1->__anon1.uc & value2));
+exp->__anon1.__anon2.string = PrintUChar((unsigned char)(op1->__anon1.uc & value2));
 if(!exp->expType)
 {
 exp->expType = op1->type;
@@ -4625,7 +4630,7 @@ static unsigned int ShortBitOr(struct Expression * exp, struct Operand * op1, st
 short value2 = op2->__anon1.s;
 
 exp->type = 2;
-exp->__anon1.__anon2.string = PrintShort((op1->__anon1.s | value2));
+exp->__anon1.__anon2.string = PrintShort((short)(op1->__anon1.s | value2));
 if(!exp->expType)
 {
 exp->expType = op1->type;
@@ -4640,7 +4645,7 @@ static unsigned int UShortBitOr(struct Expression * exp, struct Operand * op1, s
 unsigned short value2 = op2->__anon1.us;
 
 exp->type = 2;
-exp->__anon1.__anon2.string = PrintUShort((op1->__anon1.us | value2));
+exp->__anon1.__anon2.string = PrintUShort((unsigned short)(op1->__anon1.us | value2));
 if(!exp->expType)
 {
 exp->expType = op1->type;
@@ -4655,7 +4660,7 @@ static unsigned int CharBitOr(struct Expression * exp, struct Operand * op1, str
 char value2 = op2->__anon1.c;
 
 exp->type = 2;
-exp->__anon1.__anon2.string = PrintChar((op1->__anon1.c | value2));
+exp->__anon1.__anon2.string = PrintChar((char)(op1->__anon1.c | value2));
 if(!exp->expType)
 {
 exp->expType = op1->type;
@@ -4670,7 +4675,7 @@ static unsigned int UCharBitOr(struct Expression * exp, struct Operand * op1, st
 unsigned char value2 = op2->__anon1.uc;
 
 exp->type = 2;
-exp->__anon1.__anon2.string = PrintUChar((op1->__anon1.uc | value2));
+exp->__anon1.__anon2.string = PrintUChar((unsigned char)(op1->__anon1.uc | value2));
 if(!exp->expType)
 {
 exp->expType = op1->type;
@@ -4745,7 +4750,7 @@ static unsigned int ShortBitXor(struct Expression * exp, struct Operand * op1, s
 short value2 = op2->__anon1.s;
 
 exp->type = 2;
-exp->__anon1.__anon2.string = PrintShort((op1->__anon1.s ^ value2));
+exp->__anon1.__anon2.string = PrintShort((short)(op1->__anon1.s ^ value2));
 if(!exp->expType)
 {
 exp->expType = op1->type;
@@ -4760,7 +4765,7 @@ static unsigned int UShortBitXor(struct Expression * exp, struct Operand * op1,
 unsigned short value2 = op2->__anon1.us;
 
 exp->type = 2;
-exp->__anon1.__anon2.string = PrintUShort((op1->__anon1.us ^ value2));
+exp->__anon1.__anon2.string = PrintUShort((unsigned short)(op1->__anon1.us ^ value2));
 if(!exp->expType)
 {
 exp->expType = op1->type;
@@ -4775,7 +4780,7 @@ static unsigned int CharBitXor(struct Expression * exp, struct Operand * op1, st
 char value2 = op2->__anon1.c;
 
 exp->type = 2;
-exp->__anon1.__anon2.string = PrintChar((op1->__anon1.c ^ value2));
+exp->__anon1.__anon2.string = PrintChar((char)(op1->__anon1.c ^ value2));
 if(!exp->expType)
 {
 exp->expType = op1->type;
@@ -4790,7 +4795,7 @@ static unsigned int UCharBitXor(struct Expression * exp, struct Operand * op1, s
 unsigned char value2 = op2->__anon1.uc;
 
 exp->type = 2;
-exp->__anon1.__anon2.string = PrintUChar((op1->__anon1.uc ^ value2));
+exp->__anon1.__anon2.string = PrintUChar((unsigned char)(op1->__anon1.uc ^ value2));
 if(!exp->expType)
 {
 exp->expType = op1->type;
@@ -4865,7 +4870,7 @@ static unsigned int ShortLShift(struct Expression * exp, struct Operand * op1, s
 short value2 = op2->__anon1.s;
 
 exp->type = 2;
-exp->__anon1.__anon2.string = PrintShort((op1->__anon1.s << value2));
+exp->__anon1.__anon2.string = PrintShort((short)(op1->__anon1.s << value2));
 if(!exp->expType)
 {
 exp->expType = op1->type;
@@ -4880,7 +4885,7 @@ static unsigned int UShortLShift(struct Expression * exp, struct Operand * op1,
 unsigned short value2 = op2->__anon1.us;
 
 exp->type = 2;
-exp->__anon1.__anon2.string = PrintUShort((op1->__anon1.us << value2));
+exp->__anon1.__anon2.string = PrintUShort((unsigned short)(op1->__anon1.us << value2));
 if(!exp->expType)
 {
 exp->expType = op1->type;
@@ -4895,7 +4900,7 @@ static unsigned int CharLShift(struct Expression * exp, struct Operand * op1, st
 char value2 = op2->__anon1.c;
 
 exp->type = 2;
-exp->__anon1.__anon2.string = PrintChar((op1->__anon1.c << value2));
+exp->__anon1.__anon2.string = PrintChar((char)(op1->__anon1.c << value2));
 if(!exp->expType)
 {
 exp->expType = op1->type;
@@ -4910,7 +4915,7 @@ static unsigned int UCharLShift(struct Expression * exp, struct Operand * op1, s
 unsigned char value2 = op2->__anon1.uc;
 
 exp->type = 2;
-exp->__anon1.__anon2.string = PrintUChar((op1->__anon1.uc << value2));
+exp->__anon1.__anon2.string = PrintUChar((unsigned char)(op1->__anon1.uc << value2));
 if(!exp->expType)
 {
 exp->expType = op1->type;
@@ -4985,7 +4990,7 @@ static unsigned int ShortRShift(struct Expression * exp, struct Operand * op1, s
 short value2 = op2->__anon1.s;
 
 exp->type = 2;
-exp->__anon1.__anon2.string = PrintShort((op1->__anon1.s >> value2));
+exp->__anon1.__anon2.string = PrintShort((short)(op1->__anon1.s >> value2));
 if(!exp->expType)
 {
 exp->expType = op1->type;
@@ -5000,7 +5005,7 @@ static unsigned int UShortRShift(struct Expression * exp, struct Operand * op1,
 unsigned short value2 = op2->__anon1.us;
 
 exp->type = 2;
-exp->__anon1.__anon2.string = PrintUShort((op1->__anon1.us >> value2));
+exp->__anon1.__anon2.string = PrintUShort((unsigned short)(op1->__anon1.us >> value2));
 if(!exp->expType)
 {
 exp->expType = op1->type;
@@ -5015,7 +5020,7 @@ static unsigned int CharRShift(struct Expression * exp, struct Operand * op1, st
 char value2 = op2->__anon1.c;
 
 exp->type = 2;
-exp->__anon1.__anon2.string = PrintChar((op1->__anon1.c >> value2));
+exp->__anon1.__anon2.string = PrintChar((char)(op1->__anon1.c >> value2));
 if(!exp->expType)
 {
 exp->expType = op1->type;
@@ -5030,7 +5035,7 @@ static unsigned int UCharRShift(struct Expression * exp, struct Operand * op1, s
 unsigned char value2 = op2->__anon1.uc;
 
 exp->type = 2;
-exp->__anon1.__anon2.string = PrintUChar((op1->__anon1.uc >> value2));
+exp->__anon1.__anon2.string = PrintUChar((unsigned char)(op1->__anon1.uc >> value2));
 if(!exp->expType)
 {
 exp->expType = op1->type;
@@ -7608,7 +7613,12 @@ op.ops = ucharOps;
 break;
 }
 case 2:
-if(type->isSigned)
+if(exp->__anon1.__anon1.constant[0] == '\'')
+{
+op.__anon1.s = exp->__anon1.__anon1.constant[1];
+op.ops = shortOps;
+}
+else if(type->isSigned)
 {
 op.__anon1.s = (short)strtol(exp->__anon1.__anon1.constant, (((void *)0)), 0);
 op.ops = shortOps;
@@ -7621,7 +7631,12 @@ op.ops = ushortOps;
 break;
 case 3:
 case 5:
-if(type->isSigned)
+if(exp->__anon1.__anon1.constant[0] == '\'')
+{
+op.__anon1.i = exp->__anon1.__anon1.constant[1];
+op.ops = intOps;
+}
+else if(type->isSigned)
 {
 op.__anon1.i = strtol(exp->__anon1.__anon1.constant, (((void *)0)), 0);
 op.ops = intOps;
@@ -8399,7 +8414,7 @@ struct Symbol * symbol = (struct Symbol *)__ecereMethod___ecereNameSpace__ecere_
 if(symbol)
 return symbol;
 memcpy(nameSpace, name, c + 1);
-nameSpace[c + 1] = (char)0;
+nameSpace[c + 1] = 0;
 return ScanWithNameSpace(tree, nameSpace, namePart);
 }
 else if(gotColon)
@@ -9765,7 +9780,7 @@ if(function)
 {
 char name[1024];
 
-name[0] = (char)0;
+name[0] = 0;
 if(((struct __ecereNameSpace__ecere__com__Module *)(((char *)function->module + sizeof(struct __ecereNameSpace__ecere__com__Instance))))->importType != 1 && (!function->dataType || !function->dataType->dllExport))
 strcpy(name, "__ecereFunction_");
 FullClassNameCat(name, s, 0);
@@ -10440,10 +10455,10 @@ if(member)
 {
 member->memberOffset = 0;
 if(targetBits < sizeof(void *) * 8)
-member->structAlignment = (short)0;
+member->structAlignment = 0;
 }
 else if(targetBits < sizeof(void *) * 8)
-_class->structAlignment = (short)0;
+_class->structAlignment = 0;
 if(!member && ((_class->type == 0 || _class->type == 5) || (_class->type == 1 && _class->memberOffset && _class->memberOffset > _class->base->structSize)))
 _class->memberOffset = (_class->base && _class->type == 1) ? _class->base->structSize : 0;
 if(!member && _class->destructionWatchOffset)
@@ -11228,7 +11243,7 @@ if(!MatchTypes(paramDestType, paramSourceType, (((void *)0)), (((void *)0)), (((
 {
 char type[1024];
 
-type[0] = (char)0;
+type[0] = 0;
 PrintType(paramDest, type, 0, 1);
 Compiler_Warning(__ecereNameSpace__ecere__GetTranslatedString("ec", "incompatible parameter %s (expected %s)\n", (((void *)0))), paramSource->name, type);
 if(paramDestType != paramDest)
@@ -12451,7 +12466,7 @@ classSym->declaring--;
 }
 return external;
 }
-structName[0] = (char)0;
+structName[0] = 0;
 FullClassNameCat(structName, name, 0);
 classSym->declaredStructSym = 1;
 if(!external || (classSym->__anon1.registered->type == 5 && !skipNoHead && !curDeclarations))
@@ -12487,10 +12502,6 @@ if(curSpec)
 curSpec->__anon1.__anon2.definitions = declarations;
 else
 {
-char className[1024];
-
-strcpy(className, "__ecereClass_");
-FullClassNameCat(className, classSym->string, 1);
 specifiers = MkList();
 declarators = MkList();
 ListAdd(specifiers, MkStructOrUnion(3, MkIdentifier(structName), declarations));
@@ -12526,6 +12537,18 @@ classSym->__anon2.__anon1.structExternal = external = MkExternalDeclaration((((v
 external->symbol = classSym;
 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Add((&*ast), external);
 }
+if(reachedPass15 && !external->__anon1.declaration && classSym->__anon1.registered && classSym->__anon1.registered->type == 5)
+{
+char structName[1024];
+struct __ecereNameSpace__ecere__sys__OldList * specifiers, * declarators;
+
+structName[0] = 0;
+FullClassNameCat(structName, name, 0);
+specifiers = MkList();
+declarators = MkList();
+ListAdd(specifiers, MkStructOrUnion(3, MkIdentifier(structName), (((void *)0))));
+external->__anon1.declaration = MkDeclaration(specifiers, declarators);
+}
 if(fwdDecl)
 {
 struct External * e = external->fwdDecl ? external->fwdDecl : external;
@@ -13536,7 +13559,7 @@ case 24:
 case 1:
 if(type->isSigned)
 {
-char value = (char)0;
+char value = 0;
 
 if(GetChar(e, &value))
 {
@@ -13547,7 +13570,7 @@ exp->type = 2;
 }
 else
 {
-unsigned char value = (unsigned char)0;
+unsigned char value = 0;
 
 if(GetUChar(e, &value))
 {
@@ -13560,7 +13583,7 @@ break;
 case 2:
 if(type->isSigned)
 {
-short value = (short)0;
+short value = 0;
 
 if(GetShort(e, &value))
 {
@@ -13571,7 +13594,7 @@ exp->type = 2;
 }
 else
 {
-unsigned short value = (unsigned short)0;
+unsigned short value = 0;
 
 if(GetUShort(e, &value))
 {
@@ -13792,21 +13815,22 @@ unsigned int MatchTypeExpression(struct Expression * sourceExp, struct Type * de
 struct Type * source;
 struct Type * realDest = dest;
 struct Type * backupSourceExpType = (((void *)0));
-struct Expression * computedExp = sourceExp;
+struct Expression * nbExp = GetNonBracketsExp(sourceExp);
+struct Expression * computedExp = nbExp;
 
 dest->refCount++;
 if(sourceExp->isConstant && sourceExp->type != 2 && sourceExp->type != 0 && sourceExp->type != 11 && dest->kind == 8 && dest->__anon1._class && dest->__anon1._class->__anon1.registered && dest->__anon1._class->__anon1.registered->type == 4)
 {
-computedExp = CopyExpression(sourceExp);
+computedExp = CopyExpression(nbExp);
 ComputeExpression(computedExp);
 }
 source = sourceExp->expType;
 if(dest->kind == 13 && sourceExp->type == 2 && !strtoul(sourceExp->__anon1.__anon1.constant, (((void *)0)), 0))
 {
-if(computedExp != sourceExp)
+if(computedExp != nbExp)
 {
 FreeExpression(computedExp);
-computedExp = sourceExp;
+computedExp = nbExp;
 }
 FreeType(dest);
 return 1;
@@ -13823,10 +13847,10 @@ for(destBase = dest->__anon1._class->__anon1.registered; destBase && destBase->b
 ;
 if(sourceBase == destBase)
 {
-if(computedExp != sourceExp)
+if(computedExp != nbExp)
 {
 FreeExpression(computedExp);
-computedExp = sourceExp;
+computedExp = nbExp;
 }
 FreeType(dest);
 return 1;
@@ -13854,10 +13878,10 @@ value = -strtoll(computedExp->__anon1.op.exp2->__anon1.__anon1.constant, (((void
 else
 value = -strtoull(computedExp->__anon1.op.exp2->__anon1.__anon1.constant, (((void *)0)), 0);
 }
-if(computedExp != sourceExp)
+if(computedExp != nbExp)
 {
 FreeExpression(computedExp);
-computedExp = sourceExp;
+computedExp = nbExp;
 }
 if(dest->kind != 8 && source->kind == 8 && source->__anon1._class && source->__anon1._class->__anon1.registered && !strcmp(source->__anon1._class->__anon1.registered->fullName, "unichar"))
 {
@@ -14113,18 +14137,28 @@ ListAdd(specs, MkSpecifier(BOOL));
 }
 else if(dest->kind == 1 && (source->kind == 24 || source->kind == 1 || source->kind == 15 || source->kind == 2 || source->kind == 3) && (dest->isSigned ? (value >= -128 && value <= 127) : (value >= 0 && value <= 255)))
 {
+if(source->kind == 3)
+return 1;
+else
+{
 specs = MkList();
 if(!dest->isSigned)
 ListAdd(specs, MkSpecifier(UNSIGNED));
 ListAdd(specs, MkSpecifier(CHAR));
 }
+}
 else if(dest->kind == 2 && (source->kind == 15 || source->kind == 24 || source->kind == 1 || source->kind == 2 || (source->kind == 3 && (dest->isSigned ? (value >= -32768 && value <= 32767) : (value >= 0 && value <= 65535)))))
 {
+if(source->kind == 3)
+return 1;
+else
+{
 specs = MkList();
 if(!dest->isSigned)
 ListAdd(specs, MkSpecifier(UNSIGNED));
 ListAdd(specs, MkSpecifier(SHORT));
 }
+}
 else if(dest->kind == 3 && (source->kind == 15 || source->kind == 2 || source->kind == 24 || source->kind == 1 || source->kind == 3))
 {
 specs = MkList();
@@ -14194,10 +14228,10 @@ return 1;
 }
 else
 {
-if(computedExp != sourceExp)
+if(computedExp != nbExp)
 {
 FreeExpression(computedExp);
-computedExp = sourceExp;
+computedExp = nbExp;
 }
 while((sourceExp->type == 5 || sourceExp->type == 32) && sourceExp->__anon1.list)
 sourceExp = (*sourceExp->__anon1.list).last;
@@ -15606,6 +15640,7 @@ DeclareFunctionUtil((((void *)0)), "eInstance_IncRef");
 DeclareFunctionUtil((((void *)0)), "eInstance_StopWatching");
 DeclareFunctionUtil((((void *)0)), "eInstance_Watch");
 DeclareFunctionUtil((((void *)0)), "eInstance_FireWatchers");
+reachedPass15 = 1;
 for(external = (*ast).first; external; external = external->next)
 {
 afterExternal = curExternal = external;
@@ -15895,7 +15930,7 @@ char name[1024];
 
 (__ecereNameSpace__ecere__com__eSystem_Delete(id->string), id->string = 0);
 id->string = __ecereNameSpace__ecere__sys__CopyString(function->name);
-name[0] = (char)0;
+name[0] = 0;
 if(((struct __ecereNameSpace__ecere__com__Module *)(((char *)function->module + sizeof(struct __ecereNameSpace__ecere__com__Instance))))->importType != 1 && (!function->dataType || !function->dataType->dllExport))
 strcpy(name, "__ecereFunction_");
 FullClassNameCat(name, id->string, 0);
@@ -16118,8 +16153,6 @@ useDestType = 1;
 break;
 case LEFT_OP:
 case RIGHT_OP:
-useSideType = 1;
-useDestType = 1;
 break;
 case '|':
 case '^':
@@ -16198,6 +16231,16 @@ if(exp->__anon1.op.exp1->destType == dummy)
 FreeType(dummy);
 exp->__anon1.op.exp1->destType = (((void *)0));
 }
+if(exp->__anon1.op.exp2)
+{
+if(!assign && exp->__anon1.op.exp1->expType && (exp->__anon1.op.exp1->expType->kind == 1 || exp->__anon1.op.exp1->expType->kind == 2))
+{
+struct Type * type = (type = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Type), type->kind = 3, type->isSigned = 1, type->refCount = 1, type->signedBeforePromotion = exp->__anon1.op.exp1->expType->isSigned, type->bitMemberSize = exp->__anon1.op.exp1->expType->bitMemberSize, type->promotedFrom = exp->__anon1.op.exp1->expType->kind, type);
+
+FreeType(exp->__anon1.op.exp1->expType);
+exp->__anon1.op.exp1->expType = type;
+}
+}
 type1 = exp->__anon1.op.exp1->expType;
 }
 if(exp->__anon1.op.exp2)
@@ -16305,6 +16348,16 @@ ProcessExpressionType(exp->__anon1.op.exp2);
 exp->__anon1.op.exp2->opDestType = 0;
 if(exp->__anon1.op.exp2->destType && exp->__anon1.op.op != '=')
 exp->__anon1.op.exp2->destType->count--;
+if(!assign && (exp->__anon1.op.exp1 || exp->__anon1.op.op == '~'))
+{
+if(exp->__anon1.op.exp2->expType && (exp->__anon1.op.exp2->expType->kind == 1 || exp->__anon1.op.exp2->expType->kind == 2))
+{
+struct Type * type = (type = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Type), type->kind = 3, type->isSigned = 1, type->refCount = 1, type->signedBeforePromotion = exp->__anon1.op.exp2->expType->isSigned, type->bitMemberSize = exp->__anon1.op.exp2->expType->bitMemberSize, type->promotedFrom = exp->__anon1.op.exp2->expType->kind, type);
+
+FreeType(exp->__anon1.op.exp2->expType);
+exp->__anon1.op.exp2->expType = type;
+}
+}
 if(assign && type1 && type1->kind == 13 && exp->__anon1.op.exp2->expType)
 {
 if(exp->__anon1.op.exp2->expType->kind == 23 || exp->__anon1.op.exp2->expType->kind == 22 || exp->__anon1.op.exp2->expType->kind == 4 || exp->__anon1.op.exp2->expType->kind == 3 || exp->__anon1.op.exp2->expType->kind == 2 || exp->__anon1.op.exp2->expType->kind == 1)
@@ -16382,6 +16435,14 @@ notByReference = 1;
 }
 else if(exp->__anon1.op.op == '&' && !exp->__anon1.op.exp1)
 exp->expType = Reference(type2);
+else if(exp->__anon1.op.op == LEFT_OP || exp->__anon1.op.op == RIGHT_OP)
+{
+if(exp->__anon1.op.exp1->expType)
+{
+exp->expType = exp->__anon1.op.exp1->expType;
+exp->expType->refCount++;
+}
+}
 else if(!assign)
 {
 if(boolOps)
@@ -17857,6 +17918,8 @@ struct Context * context = SetupTemplatesContext(_class);
 member->dataType = ProcessTypeString(member->dataTypeString, 0);
 FinishTemplatesContext(context);
 }
+if(exp->__anon1.member.exp->expType->kind == 8 && exp->__anon1.member.exp->expType->__anon1._class && exp->__anon1.member.exp->expType->__anon1._class->__anon1.registered && exp->__anon1.member.exp->expType->__anon1._class->__anon1.registered->type == 2)
+member->dataType->bitMemberSize = ((struct __ecereNameSpace__ecere__com__BitMember *)member)->size;
 exp->expType = member->dataType;
 if(member->dataType)
 member->dataType->refCount++;
@@ -18652,6 +18715,10 @@ __ecereMethod___ecereNameSpace__ecere__sys__OldList_Add(&exp->expType->__anon1._
 }
 }
 }
+if(!notByReference && exp->expType && exp->expType->kind == 8 && exp->expType->__anon1._class && exp->expType->__anon1._class->__anon1.registered && exp->expType->__anon1._class->__anon1.registered->type == 5 && (!exp->destType || (exp->destType->kind != 3 && exp->destType->kind != 4 && exp->destType->kind != 22 && exp->destType->kind != 23 && exp->destType->kind != 5 && exp->destType->kind != 2 && exp->destType->kind != 1 && exp->destType->kind != 24)))
+{
+exp->byReference = 1;
+}
 yylloc = exp->loc;
 if(exp->destType && (exp->destType->kind == 18))
 ;
@@ -18736,6 +18803,92 @@ if(exp->destType->truth && exp->destType->__anon1._class && exp->destType->__ano
 ;
 else
 {
+struct Expression * nbExp = GetNonBracketsExp(exp);
+unsigned int skipWarning = 0;
+int kind = exp->destType->kind;
+
+if(nbExp->type == 12 && !nbExp->destType->casted && nbExp->destType->kind == exp->destType->kind)
+skipWarning = 1;
+if((kind == 1 || kind == 2) && exp->destType->isSigned == exp->expType->signedBeforePromotion && nbExp->type == 4 && nbExp->__anon1.op.exp1 && nbExp->__anon1.op.exp2)
+{
+int op = nbExp->__anon1.op.op;
+struct Expression * nbExp1, * nbExp2;
+int from;
+
+switch(op)
+{
+case '%':
+case '/':
+nbExp1 = GetNonBracketsExp(nbExp->__anon1.op.exp1);
+from = nbExp1->expType->promotedFrom;
+if(from == 1 || (kind == 2 && from == 2))
+skipWarning = 1;
+break;
+case LEFT_OP:
+case RIGHT_OP:
+nbExp1 = GetNonBracketsExp(nbExp->__anon1.op.exp1);
+nbExp2 = GetNonBracketsExp(nbExp->__anon1.op.exp2);
+from = nbExp1->expType->promotedFrom;
+if(op == RIGHT_OP && (from == 1 || (kind == 2 && from == 2)))
+skipWarning = 1;
+else if(nbExp2->isConstant && nbExp2->type == 2 && (nbExp->__anon1.op.op == RIGHT_OP || nbExp1->expType->bitMemberSize))
+{
+int n = strtol(nbExp2->__anon1.__anon1.constant, (((void *)0)), 0);
+int s = from == 1 ? 8 : 16;
+
+if(nbExp1->expType->bitMemberSize && nbExp1->expType->bitMemberSize < s)
+s = nbExp1->expType->bitMemberSize;
+if(nbExp->__anon1.op.op == RIGHT_OP)
+s -= n;
+else
+s += n;
+if(s <= (kind == 1 ? 8 : 16))
+skipWarning = 1;
+}
+break;
+case '-':
+if(!exp->destType->isSigned)
+{
+nbExp1 = GetNonBracketsExp(nbExp->__anon1.op.exp1);
+nbExp2 = GetNonBracketsExp(nbExp->__anon1.op.exp2);
+from = nbExp2->expType->promotedFrom;
+if((from == 1 || from == 2) && nbExp1->isConstant && nbExp1->type == 2)
+{
+int n = strtol(nbExp1->__anon1.__anon1.constant, (((void *)0)), 0);
+
+if(n == (from == 1 ? 255 : 65535))
+skipWarning = 1;
+}
+}
+break;
+case '|':
+{
+int kind1, kind2;
+
+nbExp1 = GetNonBracketsExp(nbExp->__anon1.op.exp1);
+nbExp2 = GetNonBracketsExp(nbExp->__anon1.op.exp2);
+kind1 = nbExp1->expType->promotedFrom ? nbExp1->expType->promotedFrom : nbExp1->expType->kind;
+kind2 = nbExp2->expType->promotedFrom ? nbExp2->expType->promotedFrom : nbExp2->expType->kind;
+if(((kind1 == 1 || (kind1 == 2 && kind == 2)) || MatchTypeExpression(nbExp1, exp->destType, (((void *)0)), 0, 0)) && ((kind2 == 1 || (kind2 == 2 && kind == 2)) || MatchTypeExpression(nbExp2, exp->destType, (((void *)0)), 0, 0)))
+skipWarning = 1;
+break;
+}
+case '&':
+{
+int kind1, kind2;
+
+nbExp1 = GetNonBracketsExp(nbExp->__anon1.op.exp1);
+nbExp2 = GetNonBracketsExp(nbExp->__anon1.op.exp2);
+kind1 = nbExp1->expType->promotedFrom ? nbExp1->expType->promotedFrom : nbExp1->expType->kind;
+kind2 = nbExp2->expType->promotedFrom ? nbExp2->expType->promotedFrom : nbExp2->expType->kind;
+if(((kind1 == 1 || (kind1 == 2 && kind == 2)) || MatchTypeExpression(nbExp1, exp->destType, (((void *)0)), 0, 0)) || ((kind2 == 1 || (kind2 == 2 && kind == 2)) || MatchTypeExpression(nbExp2, exp->destType, (((void *)0)), 0, 0)))
+skipWarning = 1;
+break;
+}
+}
+}
+if(!skipWarning)
+{
 char expString[10240];
 
 expString[0] = '\0';
@@ -18751,6 +18904,7 @@ Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString("ec", "incompatible
 else
 Compiler_Warning(__ecereNameSpace__ecere__GetTranslatedString("ec", "incompatible expression %s (%s); expected %s\n", (((void *)0))), expString, type1, type2);
 }
+}
 if(!inCompiler)
 {
 FreeType(exp->expType);
@@ -18855,7 +19009,7 @@ symbol->type->extraParam = 0;
 }
 strcpy(className, "__ecereClass_");
 FullClassNameCat(className, _class->fullName, 1);
-structName[0] = (char)0;
+structName[0] = 0;
 FullClassNameCat(structName, _class->fullName, 0);
 funcDecl = GetFuncDecl(function->declarator);
 if(funcDecl)