compiler/libec; ecere; ide: (Emscripten WIP) Address virtual method issues
[sdk] / compiler / bootstrap / libec / bootstrap / pass2.c
index 16366cf..dbb420a 100644 (file)
@@ -35,11 +35,23 @@ typedef unsigned __int64 uint64;
 #else
 #define __ENDIAN_PAD(x) 0
 #endif
+#if defined(_WIN32)
+#   if defined(__GNUC__) || defined(__TINYC__)
+#      define ecere_stdcall __attribute__((__stdcall__))
+#      define ecere_gcc_struct __attribute__((gcc_struct))
+#   else
+#      define ecere_stdcall __stdcall
+#      define ecere_gcc_struct
+#   endif
+#else
+#   define ecere_stdcall
+#   define ecere_gcc_struct
+#endif
 #include <stdint.h>
 #include <sys/types.h>
 enum yytokentype
 {
-IDENTIFIER = 258, CONSTANT = 259, STRING_LITERAL = 260, SIZEOF = 261, PTR_OP = 262, INC_OP = 263, DEC_OP = 264, LEFT_OP = 265, RIGHT_OP = 266, LE_OP = 267, GE_OP = 268, EQ_OP = 269, NE_OP = 270, AND_OP = 271, OR_OP = 272, MUL_ASSIGN = 273, DIV_ASSIGN = 274, MOD_ASSIGN = 275, ADD_ASSIGN = 276, SUB_ASSIGN = 277, LEFT_ASSIGN = 278, RIGHT_ASSIGN = 279, AND_ASSIGN = 280, XOR_ASSIGN = 281, OR_ASSIGN = 282, TYPE_NAME = 283, TYPEDEF = 284, EXTERN = 285, STATIC = 286, AUTO = 287, REGISTER = 288, CHAR = 289, SHORT = 290, INT = 291, UINT = 292, INT64 = 293, LONG = 294, SIGNED = 295, UNSIGNED = 296, FLOAT = 297, DOUBLE = 298, CONST = 299, VOLATILE = 300, VOID = 301, VALIST = 302, STRUCT = 303, UNION = 304, ENUM = 305, ELLIPSIS = 306, CASE = 307, DEFAULT = 308, IF = 309, SWITCH = 310, WHILE = 311, DO = 312, FOR = 313, GOTO = 314, CONTINUE = 315, BREAK = 316, RETURN = 317, IFX = 318, ELSE = 319, CLASS = 320, THISCLASS = 321, CLASS_NAME = 322, PROPERTY = 323, SETPROP = 324, GETPROP = 325, NEWOP = 326, RENEW = 327, DELETE = 328, EXT_DECL = 329, EXT_STORAGE = 330, IMPORT = 331, DEFINE = 332, VIRTUAL = 333, ATTRIB = 334, PUBLIC = 335, PRIVATE = 336, TYPED_OBJECT = 337, ANY_OBJECT = 338, _INCREF = 339, EXTENSION = 340, ASM = 341, TYPEOF = 342, WATCH = 343, STOPWATCHING = 344, FIREWATCHERS = 345, WATCHABLE = 346, CLASS_DESIGNER = 347, CLASS_NO_EXPANSION = 348, CLASS_FIXED = 349, ISPROPSET = 350, CLASS_DEFAULT_PROPERTY = 351, PROPERTY_CATEGORY = 352, CLASS_DATA = 353, CLASS_PROPERTY = 354, SUBCLASS = 355, NAMESPACE = 356, NEW0OP = 357, RENEW0 = 358, VAARG = 359, DBTABLE = 360, DBFIELD = 361, DBINDEX = 362, DATABASE_OPEN = 363, ALIGNOF = 364, ATTRIB_DEP = 365, __ATTRIB = 366, BOOL = 367, _BOOL = 368, _COMPLEX = 369, _IMAGINARY = 370, RESTRICT = 371, THREAD = 372, WIDE_STRING_LITERAL = 373
+IDENTIFIER = 258, CONSTANT = 259, STRING_LITERAL = 260, SIZEOF = 261, PTR_OP = 262, INC_OP = 263, DEC_OP = 264, LEFT_OP = 265, RIGHT_OP = 266, LE_OP = 267, GE_OP = 268, EQ_OP = 269, NE_OP = 270, AND_OP = 271, OR_OP = 272, MUL_ASSIGN = 273, DIV_ASSIGN = 274, MOD_ASSIGN = 275, ADD_ASSIGN = 276, SUB_ASSIGN = 277, LEFT_ASSIGN = 278, RIGHT_ASSIGN = 279, AND_ASSIGN = 280, XOR_ASSIGN = 281, OR_ASSIGN = 282, TYPE_NAME = 283, TYPEDEF = 284, EXTERN = 285, STATIC = 286, AUTO = 287, REGISTER = 288, CHAR = 289, SHORT = 290, INT = 291, UINT = 292, INT64 = 293, LONG = 294, SIGNED = 295, UNSIGNED = 296, FLOAT = 297, DOUBLE = 298, CONST = 299, VOLATILE = 300, VOID = 301, VALIST = 302, STRUCT = 303, UNION = 304, ENUM = 305, ELLIPSIS = 306, CASE = 307, DEFAULT = 308, IF = 309, SWITCH = 310, WHILE = 311, DO = 312, FOR = 313, GOTO = 314, CONTINUE = 315, BREAK = 316, RETURN = 317, IFX = 318, ELSE = 319, CLASS = 320, THISCLASS = 321, CLASS_NAME = 322, PROPERTY = 323, SETPROP = 324, GETPROP = 325, NEWOP = 326, RENEW = 327, DELETE = 328, EXT_DECL = 329, EXT_STORAGE = 330, IMPORT = 331, DEFINE = 332, VIRTUAL = 333, ATTRIB = 334, PUBLIC = 335, PRIVATE = 336, TYPED_OBJECT = 337, ANY_OBJECT = 338, _INCREF = 339, EXTENSION = 340, ASM = 341, TYPEOF = 342, WATCH = 343, STOPWATCHING = 344, FIREWATCHERS = 345, WATCHABLE = 346, CLASS_DESIGNER = 347, CLASS_NO_EXPANSION = 348, CLASS_FIXED = 349, ISPROPSET = 350, CLASS_DEFAULT_PROPERTY = 351, PROPERTY_CATEGORY = 352, CLASS_DATA = 353, CLASS_PROPERTY = 354, SUBCLASS = 355, NAMESPACE = 356, NEW0OP = 357, RENEW0 = 358, VAARG = 359, DBTABLE = 360, DBFIELD = 361, DBINDEX = 362, DATABASE_OPEN = 363, ALIGNOF = 364, ATTRIB_DEP = 365, __ATTRIB = 366, BOOL = 367, _BOOL = 368, _COMPLEX = 369, _IMAGINARY = 370, RESTRICT = 371, THREAD = 372, WIDE_STRING_LITERAL = 373, BUILTIN_OFFSETOF = 374
 };
 
 extern unsigned int internalValueCounter;
@@ -55,7 +67,7 @@ void *  last;
 int count;
 unsigned int offset;
 unsigned int circ;
-} __attribute__ ((gcc_struct));
+} ecere_gcc_struct;
 
 struct __ecereNameSpace__ecere__sys__BTNode;
 
@@ -74,8 +86,8 @@ float f;
 double d;
 long long i64;
 uint64 ui64;
-} __attribute__ ((gcc_struct)) __anon1;
-} __attribute__ ((gcc_struct));
+} ecere_gcc_struct __anon1;
+} ecere_gcc_struct;
 
 struct __ecereNameSpace__ecere__com__SerialBuffer
 {
@@ -83,7 +95,7 @@ unsigned char *  _buffer;
 unsigned int count;
 unsigned int _size;
 unsigned int pos;
-} __attribute__ ((gcc_struct));
+} ecere_gcc_struct;
 
 extern void *  __ecereNameSpace__ecere__com__eSystem_New(unsigned int size);
 
@@ -97,8 +109,6 @@ extern void __ecereNameSpace__ecere__com__eSystem_Delete(void *  memory);
 
 struct Enumerator;
 
-struct Pointer;
-
 struct Attrib;
 
 struct ExtDecl;
@@ -119,7 +129,7 @@ int line;
 int charPos;
 int pos;
 int included;
-} __attribute__ ((gcc_struct));
+} ecere_gcc_struct;
 
 struct ModuleImport;
 
@@ -144,7 +154,7 @@ struct __ecereNameSpace__ecere__com__LinkList
 void * first;
 void * last;
 int count;
-} __attribute__ ((gcc_struct));
+} ecere_gcc_struct;
 
 extern void Compiler_Error(const char *  format, ...);
 
@@ -172,13 +182,11 @@ void __ecereMethod___ecereNameSpace__ecere__sys__OldList_Add(struct __ecereNameS
 
 unsigned int __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert(struct __ecereNameSpace__ecere__sys__OldList * this, void *  prevItem, void *  item);
 
-extern struct Pointer * MkPointer(struct __ecereNameSpace__ecere__sys__OldList * qualifiers, struct Pointer * pointer);
-
 struct Location
 {
 struct CodePosition start;
 struct CodePosition end;
-} __attribute__ ((gcc_struct));
+} ecere_gcc_struct;
 
 extern struct Location yylloc;
 
@@ -217,7 +225,7 @@ struct __ecereNameSpace__ecere__com__Instance
 void * *  _vTbl;
 struct __ecereNameSpace__ecere__com__Class * _class;
 int _refCount;
-} __attribute__ ((gcc_struct));
+} ecere_gcc_struct;
 
 extern long long __ecereNameSpace__ecere__com__eClass_GetProperty(struct __ecereNameSpace__ecere__com__Class * _class, const char *  name);
 
@@ -275,10 +283,10 @@ extern struct Expression * MkExpCall(struct Expression * expression, struct __ec
 
 extern void ProcessExpressionType(struct Expression * exp);
 
-extern struct Expression * MkExpCondition(struct Expression * cond, struct __ecereNameSpace__ecere__sys__OldList * expressions, struct Expression * elseExp);
-
 extern struct Expression * MkExpExtensionCompound(struct Statement * compound);
 
+extern struct Expression * MkExpCondition(struct Expression * cond, struct __ecereNameSpace__ecere__sys__OldList * expressions, struct Expression * elseExp);
+
 extern void ProcessExpressionInstPass(struct Expression * exp);
 
 extern struct Expression * MoveExpContents(struct Expression * exp);
@@ -289,12 +297,14 @@ extern struct Declarator * SpecDeclFromString(const char *  string, struct __ece
 
 extern struct Declarator * MkDeclaratorBrackets(struct Declarator * declarator);
 
-extern struct Declarator * MkDeclaratorPointer(struct Pointer * pointer, struct Declarator * declarator);
-
 extern struct Declarator * GetFuncDecl(struct Declarator * decl);
 
 extern struct Declarator * QMkPtrDecl(const char *  id);
 
+extern struct Declarator * CopyDeclarator(struct Declarator * declarator);
+
+extern struct Declarator * PlugDeclarator(struct Declarator * decl, struct Declarator * baseDecl);
+
 extern void FreeDeclarator(struct Declarator * decl);
 
 extern char *  StringFromSpecDecl(struct __ecereNameSpace__ecere__sys__OldList * specs, struct Declarator * decl);
@@ -303,9 +313,7 @@ struct TemplateDatatype
 {
 struct __ecereNameSpace__ecere__sys__OldList *  specifiers;
 struct Declarator * decl;
-} __attribute__ ((gcc_struct));
-
-extern struct Declarator * CopyDeclarator(struct Declarator * declarator);
+} ecere_gcc_struct;
 
 struct Specifier;
 
@@ -315,10 +323,10 @@ extern void FreeSpecifier(struct Specifier * spec);
 
 extern struct Specifier * MkSpecifier(int specifier);
 
-extern struct Expression * MkExpClassSize(struct Specifier * _class);
-
 extern struct Specifier * CopySpecifier(struct Specifier * spec);
 
+extern struct Expression * MkExpClassSize(struct Specifier * _class);
+
 struct Symbol;
 
 extern struct Symbol * FindClass(const char *  name);
@@ -329,43 +337,6 @@ extern void FreeSymbol(struct Symbol * symbol);
 
 struct Identifier;
 
-struct Declarator
-{
-struct Declarator * prev;
-struct Declarator * next;
-struct Location loc;
-int type;
-struct Symbol * symbol;
-struct Declarator * declarator;
-union
-{
-struct Identifier * identifier;
-struct
-{
-struct Expression * exp;
-struct Expression * posExp;
-struct Attrib * attrib;
-} __attribute__ ((gcc_struct)) structDecl;
-struct
-{
-struct Expression * exp;
-struct Specifier * enumClass;
-} __attribute__ ((gcc_struct)) array;
-struct
-{
-struct __ecereNameSpace__ecere__sys__OldList * parameters;
-} __attribute__ ((gcc_struct)) function;
-struct
-{
-struct Pointer * pointer;
-} __attribute__ ((gcc_struct)) pointer;
-struct
-{
-struct ExtDecl * extended;
-} __attribute__ ((gcc_struct)) extended;
-} __attribute__ ((gcc_struct)) __anon1;
-} __attribute__ ((gcc_struct));
-
 extern void FreeIdentifier(struct Identifier * id);
 
 extern struct Expression * MkExpPointer(struct Expression * expression, struct Identifier * member);
@@ -383,7 +354,7 @@ struct Symbol * classSym;
 struct Specifier * _class;
 char *  string;
 struct Identifier * badID;
-} __attribute__ ((gcc_struct));
+} ecere_gcc_struct;
 
 extern struct Declarator * MkDeclaratorIdentifier(struct Identifier * id);
 
@@ -417,7 +388,7 @@ const char *  category;
 unsigned int compiled;
 unsigned int selfWatchable;
 unsigned int isWatchable;
-} __attribute__ ((gcc_struct));
+} ecere_gcc_struct;
 
 extern struct Type * MkClassType(const char *  name);
 
@@ -452,7 +423,7 @@ unsigned char *  data;
 struct Location nameLoc;
 struct Location insideLoc;
 unsigned int built;
-} __attribute__ ((gcc_struct));
+} ecere_gcc_struct;
 
 struct TypeName;
 
@@ -465,7 +436,7 @@ struct __ecereNameSpace__ecere__sys__OldList *  qualifiers;
 struct Declarator * declarator;
 int classObjectType;
 struct Expression * bitCount;
-} __attribute__ ((gcc_struct));
+} ecere_gcc_struct;
 
 extern struct TypeName * MkTypeName(struct __ecereNameSpace__ecere__sys__OldList * qualifiers, struct Declarator * declarator);
 
@@ -477,6 +448,58 @@ extern struct TypeName * QMkType(const char *  spec, struct Declarator * decl);
 
 extern void FreeTypeName(struct TypeName * typeName);
 
+struct Pointer;
+
+extern struct Declarator * MkDeclaratorPointer(struct Pointer * pointer, struct Declarator * declarator);
+
+extern struct Pointer * MkPointer(struct __ecereNameSpace__ecere__sys__OldList * qualifiers, struct Pointer * pointer);
+
+struct Declarator
+{
+struct Declarator * prev;
+struct Declarator * next;
+struct Location loc;
+int type;
+struct Symbol * symbol;
+struct Declarator * declarator;
+union
+{
+struct Identifier * identifier;
+struct
+{
+struct Expression * exp;
+struct Expression * posExp;
+struct Attrib * attrib;
+} ecere_gcc_struct structDecl;
+struct
+{
+struct Expression * exp;
+struct Specifier * enumClass;
+} ecere_gcc_struct array;
+struct
+{
+struct __ecereNameSpace__ecere__sys__OldList * parameters;
+} ecere_gcc_struct function;
+struct
+{
+struct Pointer * pointer;
+} ecere_gcc_struct pointer;
+struct
+{
+struct ExtDecl * extended;
+} ecere_gcc_struct extended;
+} ecere_gcc_struct __anon1;
+} ecere_gcc_struct;
+
+struct Pointer
+{
+struct Pointer * prev;
+struct Pointer * next;
+struct Location loc;
+struct __ecereNameSpace__ecere__sys__OldList *  qualifiers;
+struct Pointer * pointer;
+} ecere_gcc_struct;
+
 struct Declaration;
 
 struct Statement
@@ -492,51 +515,51 @@ struct
 {
 struct Identifier * id;
 struct Statement * stmt;
-} __attribute__ ((gcc_struct)) labeled;
+} ecere_gcc_struct labeled;
 struct
 {
 struct Expression * exp;
 struct Statement * stmt;
-} __attribute__ ((gcc_struct)) caseStmt;
+} ecere_gcc_struct caseStmt;
 struct
 {
 struct __ecereNameSpace__ecere__sys__OldList * declarations;
 struct __ecereNameSpace__ecere__sys__OldList * statements;
 struct Context * context;
 unsigned int isSwitch;
-} __attribute__ ((gcc_struct)) compound;
+} ecere_gcc_struct compound;
 struct
 {
 struct __ecereNameSpace__ecere__sys__OldList * exp;
 struct Statement * stmt;
 struct Statement * elseStmt;
-} __attribute__ ((gcc_struct)) ifStmt;
+} ecere_gcc_struct ifStmt;
 struct
 {
 struct __ecereNameSpace__ecere__sys__OldList * exp;
 struct Statement * stmt;
-} __attribute__ ((gcc_struct)) switchStmt;
+} ecere_gcc_struct switchStmt;
 struct
 {
 struct __ecereNameSpace__ecere__sys__OldList * exp;
 struct Statement * stmt;
-} __attribute__ ((gcc_struct)) whileStmt;
+} ecere_gcc_struct whileStmt;
 struct
 {
 struct __ecereNameSpace__ecere__sys__OldList * exp;
 struct Statement * stmt;
-} __attribute__ ((gcc_struct)) doWhile;
+} ecere_gcc_struct doWhile;
 struct
 {
 struct Statement * init;
 struct Statement * check;
 struct __ecereNameSpace__ecere__sys__OldList * increment;
 struct Statement * stmt;
-} __attribute__ ((gcc_struct)) forStmt;
+} ecere_gcc_struct forStmt;
 struct
 {
 struct Identifier * id;
-} __attribute__ ((gcc_struct)) gotoStmt;
+} ecere_gcc_struct gotoStmt;
 struct
 {
 struct Specifier * spec;
@@ -544,23 +567,23 @@ char * statements;
 struct __ecereNameSpace__ecere__sys__OldList * inputFields;
 struct __ecereNameSpace__ecere__sys__OldList * outputFields;
 struct __ecereNameSpace__ecere__sys__OldList * clobberedFields;
-} __attribute__ ((gcc_struct)) asmStmt;
+} ecere_gcc_struct asmStmt;
 struct
 {
 struct Expression * watcher;
 struct Expression * object;
 struct __ecereNameSpace__ecere__sys__OldList * watches;
-} __attribute__ ((gcc_struct)) _watch;
+} ecere_gcc_struct _watch;
 struct
 {
 struct Identifier * id;
 struct __ecereNameSpace__ecere__sys__OldList * exp;
 struct __ecereNameSpace__ecere__sys__OldList * filter;
 struct Statement * stmt;
-} __attribute__ ((gcc_struct)) forEachStmt;
+} ecere_gcc_struct forEachStmt;
 struct Declaration * decl;
-} __attribute__ ((gcc_struct)) __anon1;
-} __attribute__ ((gcc_struct));
+} ecere_gcc_struct __anon1;
+} ecere_gcc_struct;
 
 extern struct Declaration * MkDeclaration(struct __ecereNameSpace__ecere__sys__OldList * specifiers, struct __ecereNameSpace__ecere__sys__OldList * initDeclarators);
 
@@ -578,18 +601,18 @@ struct
 {
 struct __ecereNameSpace__ecere__sys__OldList *  specifiers;
 struct __ecereNameSpace__ecere__sys__OldList *  declarators;
-} __attribute__ ((gcc_struct)) __anon1;
+} ecere_gcc_struct __anon1;
 struct Instantiation * inst;
 struct
 {
 struct Identifier * id;
 struct Expression * exp;
-} __attribute__ ((gcc_struct)) __anon2;
-} __attribute__ ((gcc_struct)) __anon1;
+} ecere_gcc_struct __anon2;
+} ecere_gcc_struct __anon1;
 struct Specifier * extStorage;
 struct Symbol * symbol;
 int declMode;
-} __attribute__ ((gcc_struct));
+} ecere_gcc_struct;
 
 struct Initializer;
 
@@ -605,7 +628,7 @@ struct
 {
 char *  constant;
 struct Identifier * identifier;
-} __attribute__ ((gcc_struct)) __anon1;
+} ecere_gcc_struct __anon1;
 struct Statement * compound;
 struct Instantiation * instance;
 struct
@@ -613,86 +636,91 @@ struct
 char *  string;
 unsigned int intlString;
 unsigned int wideString;
-} __attribute__ ((gcc_struct)) __anon2;
+} ecere_gcc_struct __anon2;
 struct __ecereNameSpace__ecere__sys__OldList *  list;
 struct
 {
 struct __ecereNameSpace__ecere__sys__OldList * specifiers;
 struct Declarator * decl;
-} __attribute__ ((gcc_struct)) _classExp;
+} ecere_gcc_struct _classExp;
 struct
 {
 struct Identifier * id;
-} __attribute__ ((gcc_struct)) classData;
+} ecere_gcc_struct classData;
 struct
 {
 struct Expression * exp;
 struct __ecereNameSpace__ecere__sys__OldList * arguments;
 struct Location argLoc;
-} __attribute__ ((gcc_struct)) call;
+} ecere_gcc_struct call;
 struct
 {
 struct Expression * exp;
 struct __ecereNameSpace__ecere__sys__OldList * index;
-} __attribute__ ((gcc_struct)) index;
+} ecere_gcc_struct index;
 struct
 {
 struct Expression * exp;
 struct Identifier * member;
 int memberType;
 unsigned int thisPtr;
-} __attribute__ ((gcc_struct)) member;
+} ecere_gcc_struct member;
 struct
 {
 int op;
 struct Expression * exp1;
 struct Expression * exp2;
-} __attribute__ ((gcc_struct)) op;
+} ecere_gcc_struct op;
 struct TypeName * typeName;
 struct Specifier * _class;
 struct
 {
 struct TypeName * typeName;
 struct Expression * exp;
-} __attribute__ ((gcc_struct)) cast;
+} ecere_gcc_struct cast;
 struct
 {
 struct Expression * cond;
 struct __ecereNameSpace__ecere__sys__OldList * exp;
 struct Expression * elseExp;
-} __attribute__ ((gcc_struct)) cond;
+} ecere_gcc_struct cond;
 struct
 {
 struct TypeName * typeName;
 struct Expression * size;
-} __attribute__ ((gcc_struct)) _new;
+} ecere_gcc_struct _new;
 struct
 {
 struct TypeName * typeName;
 struct Expression * size;
 struct Expression * exp;
-} __attribute__ ((gcc_struct)) _renew;
+} ecere_gcc_struct _renew;
 struct
 {
 char * table;
 struct Identifier * id;
-} __attribute__ ((gcc_struct)) db;
+} ecere_gcc_struct db;
 struct
 {
 struct Expression * ds;
 struct Expression * name;
-} __attribute__ ((gcc_struct)) dbopen;
+} ecere_gcc_struct dbopen;
 struct
 {
 struct TypeName * typeName;
 struct Initializer * initializer;
-} __attribute__ ((gcc_struct)) initializer;
+} ecere_gcc_struct initializer;
 struct
 {
 struct Expression * exp;
 struct TypeName * typeName;
-} __attribute__ ((gcc_struct)) vaArg;
-} __attribute__ ((gcc_struct)) __anon1;
+} ecere_gcc_struct vaArg;
+struct
+{
+struct TypeName * typeName;
+struct Identifier * id;
+} ecere_gcc_struct offset;
+} ecere_gcc_struct __anon1;
 unsigned int debugValue;
 struct __ecereNameSpace__ecere__com__DataValue val;
 uint64 address;
@@ -707,8 +735,11 @@ unsigned int addedThis;
 unsigned int needCast;
 unsigned int thisPtr;
 unsigned int opDestType;
+unsigned int usedInComparison;
+unsigned int ambiguousUnits;
+unsigned int parentOpDestType;
 unsigned int needTemplateCast;
-} __attribute__ ((gcc_struct));
+} ecere_gcc_struct;
 
 extern struct Initializer * MkInitializerAssignment(struct Expression * exp);
 
@@ -722,10 +753,10 @@ union
 {
 struct Expression * exp;
 struct __ecereNameSpace__ecere__sys__OldList *  list;
-} __attribute__ ((gcc_struct)) __anon1;
+} ecere_gcc_struct __anon1;
 unsigned int isConstant;
 struct Identifier * id;
-} __attribute__ ((gcc_struct));
+} ecere_gcc_struct;
 
 static void _FixRefExp(struct Expression ** expPtr, struct Expression ** memberExpPtr)
 {
@@ -822,7 +853,7 @@ struct __ecereNameSpace__ecere__sys__BTNode * root;
 int count;
 int (*  CompareKey)(struct __ecereNameSpace__ecere__sys__BinaryTree * tree, uintptr_t a, uintptr_t b);
 void (*  FreeKey)(void *  key);
-} __attribute__ ((gcc_struct));
+} ecere_gcc_struct;
 
 unsigned int __ecereMethod___ecereNameSpace__ecere__sys__BinaryTree_Add(struct __ecereNameSpace__ecere__sys__BinaryTree * this, struct __ecereNameSpace__ecere__sys__BTNode * node);
 
@@ -845,7 +876,7 @@ void *  symbol;
 const char *  dataTypeString;
 struct Type * dataType;
 int memberAccess;
-} __attribute__ ((gcc_struct));
+} ecere_gcc_struct;
 
 struct Symbol
 {
@@ -860,7 +891,7 @@ union
 struct __ecereNameSpace__ecere__com__Method * method;
 struct __ecereNameSpace__ecere__com__Property * _property;
 struct __ecereNameSpace__ecere__com__Class * registered;
-} __attribute__ ((gcc_struct)) __anon1;
+} ecere_gcc_struct __anon1;
 unsigned int notYetDeclared;
 union
 {
@@ -868,20 +899,20 @@ struct
 {
 struct External * pointerExternal;
 struct External * structExternal;
-} __attribute__ ((gcc_struct)) __anon1;
+} ecere_gcc_struct __anon1;
 struct
 {
 struct External * externalGet;
 struct External * externalSet;
 struct External * externalPtr;
 struct External * externalIsSet;
-} __attribute__ ((gcc_struct)) __anon2;
+} ecere_gcc_struct __anon2;
 struct
 {
 struct External * methodExternal;
 struct External * methodCodeExternal;
-} __attribute__ ((gcc_struct)) __anon3;
-} __attribute__ ((gcc_struct)) __anon2;
+} ecere_gcc_struct __anon3;
+} ecere_gcc_struct __anon2;
 unsigned int imported;
 unsigned int declaredStructSym;
 struct __ecereNameSpace__ecere__com__Class * _class;
@@ -909,7 +940,7 @@ struct Context * ctx;
 int isIterator;
 struct Expression * propCategory;
 unsigned int mustRegister;
-} __attribute__ ((gcc_struct));
+} ecere_gcc_struct;
 
 extern void DeclareMethod(struct External * neededFor, struct __ecereNameSpace__ecere__com__Method * method, const char *  name);
 
@@ -923,7 +954,7 @@ struct Location loc;
 struct Statement * compound;
 struct __ecereNameSpace__ecere__sys__OldList *  properties;
 unsigned int deleteWatch;
-} __attribute__ ((gcc_struct));
+} ecere_gcc_struct;
 
 struct __ecereNameSpace__ecere__com__ClassProperty;
 
@@ -941,7 +972,7 @@ long long (*  Get)(struct __ecereNameSpace__ecere__com__Class *);
 const char *  dataTypeString;
 struct Type * dataType;
 unsigned int constant;
-} __attribute__ ((gcc_struct));
+} ecere_gcc_struct;
 
 struct __ecereNameSpace__ecere__com__Module;
 
@@ -969,7 +1000,7 @@ struct
 {
 struct __ecereNameSpace__ecere__sys__OldList members;
 char *  enumName;
-} __attribute__ ((gcc_struct)) __anon1;
+} ecere_gcc_struct __anon1;
 struct
 {
 struct Type * returnType;
@@ -977,13 +1008,13 @@ struct __ecereNameSpace__ecere__sys__OldList params;
 struct Symbol * thisClass;
 unsigned int staticMethod;
 struct TemplateParameter * thisClassTemplate;
-} __attribute__ ((gcc_struct)) __anon2;
+} ecere_gcc_struct __anon2;
 struct
 {
 struct __ecereNameSpace__ecere__com__Method * method;
 struct __ecereNameSpace__ecere__com__Class * methodClass;
 struct __ecereNameSpace__ecere__com__Class * usedClass;
-} __attribute__ ((gcc_struct)) __anon3;
+} ecere_gcc_struct __anon3;
 struct
 {
 struct Type * arrayType;
@@ -991,20 +1022,22 @@ int arraySize;
 struct Expression * arraySizeExp;
 unsigned int freeExp;
 struct Symbol * enumClass;
-} __attribute__ ((gcc_struct)) __anon4;
+} ecere_gcc_struct __anon4;
 struct Type * type;
 struct TemplateParameter * templateParameter;
-} __attribute__ ((gcc_struct)) __anon1;
+} ecere_gcc_struct __anon1;
 int kind;
 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;
@@ -1020,7 +1053,9 @@ unsigned int declaredWithStruct : 1;
 unsigned int typedByReference : 1;
 unsigned int casted : 1;
 unsigned int pointerAlignment : 1;
-} __attribute__ ((gcc_struct));
+unsigned int isLong : 1;
+unsigned int signedBeforePromotion : 1;
+} ecere_gcc_struct;
 
 struct Specifier
 {
@@ -1038,7 +1073,7 @@ char *  name;
 struct Symbol * symbol;
 struct __ecereNameSpace__ecere__sys__OldList *  templateArgs;
 struct Specifier * nsSpec;
-} __attribute__ ((gcc_struct)) __anon1;
+} ecere_gcc_struct __anon1;
 struct
 {
 struct Identifier * id;
@@ -1048,12 +1083,12 @@ struct __ecereNameSpace__ecere__sys__OldList *  definitions;
 unsigned int addNameSpace;
 struct Context * ctx;
 struct ExtDecl * extDeclStruct;
-} __attribute__ ((gcc_struct)) __anon2;
+} ecere_gcc_struct __anon2;
 struct Expression * expression;
 struct Specifier * _class;
 struct TemplateParameter * templateParameter;
-} __attribute__ ((gcc_struct)) __anon1;
-} __attribute__ ((gcc_struct));
+} ecere_gcc_struct __anon1;
+} ecere_gcc_struct;
 
 extern struct Expression * GetTemplateArgExp(struct TemplateParameter * param, struct __ecereNameSpace__ecere__com__Class * curClass, unsigned int pointer);
 
@@ -1070,11 +1105,11 @@ union
 {
 struct TemplateDatatype * dataType;
 int memberType;
-} __attribute__ ((gcc_struct)) __anon1;
+} ecere_gcc_struct __anon1;
 struct TemplateArgument * defaultArgument;
 const char *  dataTypeString;
 struct Type * baseType;
-} __attribute__ ((gcc_struct));
+} ecere_gcc_struct;
 
 unsigned int __ecereProp_Type_Get_isPointerType(struct Type * this);
 
@@ -1095,7 +1130,7 @@ struct __ecereNameSpace__ecere__sys__BinaryTree templateTypes;
 struct ClassDefinition * classDef;
 unsigned int templateTypesOnly;
 unsigned int hasNameSpace;
-} __attribute__ ((gcc_struct));
+} ecere_gcc_struct;
 
 struct ClassDefinition
 {
@@ -1110,7 +1145,7 @@ struct Location blockStart;
 struct Location nameLoc;
 int declMode;
 unsigned int deleteWatchable;
-} __attribute__ ((gcc_struct));
+} ecere_gcc_struct;
 
 struct AsmField;
 
@@ -1122,7 +1157,7 @@ struct Location loc;
 char *  command;
 struct Expression * expression;
 struct Identifier * symbolic;
-} __attribute__ ((gcc_struct));
+} ecere_gcc_struct;
 
 struct PropertyDef;
 
@@ -1144,8 +1179,8 @@ struct
 unsigned int conversion : 1;
 unsigned int isWatchable : 1;
 unsigned int isDBProp : 1;
-} __attribute__ ((gcc_struct)) __anon1;
-} __attribute__ ((gcc_struct));
+} ecere_gcc_struct __anon1;
+} ecere_gcc_struct;
 
 struct __ecereNameSpace__ecere__com__BitMember;
 
@@ -1165,7 +1200,7 @@ int type;
 int size;
 int pos;
 uint64 mask;
-} __attribute__ ((gcc_struct));
+} ecere_gcc_struct;
 
 struct FunctionDefinition;
 
@@ -1184,13 +1219,13 @@ struct Declaration * declaration;
 char *  importString;
 struct Identifier * id;
 struct DBTableDef * table;
-} __attribute__ ((gcc_struct)) __anon1;
+} ecere_gcc_struct __anon1;
 int importType;
 struct External * fwdDecl;
 struct __ecereNameSpace__ecere__com__Instance * outgoing;
 struct __ecereNameSpace__ecere__com__Instance * incoming;
 int nonBreakableIncoming;
-} __attribute__ ((gcc_struct));
+} ecere_gcc_struct;
 
 struct FunctionDefinition
 {
@@ -1208,7 +1243,7 @@ struct Type * type;
 struct Symbol * propSet;
 int tempCount;
 unsigned int propertyNoThis;
-} __attribute__ ((gcc_struct));
+} ecere_gcc_struct;
 
 struct ClassFunction;
 
@@ -1222,8 +1257,8 @@ union
 {
 struct __ecereNameSpace__ecere__sys__OldList *  dataMembers;
 struct ClassFunction * function;
-} __attribute__ ((gcc_struct)) __anon1;
-} __attribute__ ((gcc_struct));
+} ecere_gcc_struct __anon1;
+} ecere_gcc_struct;
 
 struct ClassFunction
 {
@@ -1245,7 +1280,7 @@ unsigned int isDestructor;
 unsigned int dontMangle;
 int id;
 int idCode;
-} __attribute__ ((gcc_struct));
+} ecere_gcc_struct;
 
 struct InitDeclarator;
 
@@ -1258,7 +1293,7 @@ struct InitDeclarator * next;
 struct Location loc;
 struct Declarator * declarator;
 struct Initializer * initializer;
-} __attribute__ ((gcc_struct));
+} ecere_gcc_struct;
 
 struct MemberInit;
 
@@ -1275,7 +1310,7 @@ struct Initializer * initializer;
 unsigned int used;
 unsigned int variable;
 unsigned int takeOutExp;
-} __attribute__ ((gcc_struct));
+} ecere_gcc_struct;
 
 static struct Expression *  FixReference(struct Expression *  e, unsigned int wantReference);
 
@@ -1321,7 +1356,7 @@ struct __ecereNameSpace__ecere__sys__BinaryTree nameSpaces;
 struct __ecereNameSpace__ecere__sys__BinaryTree classes;
 struct __ecereNameSpace__ecere__sys__BinaryTree defines;
 struct __ecereNameSpace__ecere__sys__BinaryTree functions;
-} __attribute__ ((gcc_struct));
+} ecere_gcc_struct;
 
 struct __ecereNameSpace__ecere__com__Application
 {
@@ -1332,7 +1367,7 @@ unsigned int isGUIApp;
 struct __ecereNameSpace__ecere__sys__OldList allModules;
 char *  parsedCommand;
 struct __ecereNameSpace__ecere__com__NameSpace systemNameSpace;
-} __attribute__ ((gcc_struct));
+} ecere_gcc_struct;
 
 struct __ecereNameSpace__ecere__com__Module
 {
@@ -1350,7 +1385,7 @@ int importType;
 int origImportType;
 struct __ecereNameSpace__ecere__com__NameSpace privateNameSpace;
 struct __ecereNameSpace__ecere__com__NameSpace publicNameSpace;
-} __attribute__ ((gcc_struct));
+} ecere_gcc_struct;
 
 void __ecereUnregisterModule_pass2(struct __ecereNameSpace__ecere__com__Instance * module)
 {
@@ -1367,7 +1402,7 @@ struct
 {
 const char *  dataTypeString;
 struct __ecereNameSpace__ecere__com__Class * dataTypeClass;
-} __attribute__ ((gcc_struct)) __anon1;
+} ecere_gcc_struct __anon1;
 struct __ecereNameSpace__ecere__com__DataValue expression;
 struct
 {
@@ -1377,10 +1412,10 @@ union
 struct __ecereNameSpace__ecere__com__DataMember * member;
 struct __ecereNameSpace__ecere__com__Property * prop;
 struct __ecereNameSpace__ecere__com__Method * method;
-} __attribute__ ((gcc_struct)) __anon1;
-} __attribute__ ((gcc_struct)) __anon2;
-} __attribute__ ((gcc_struct)) __anon1;
-} __attribute__ ((gcc_struct));
+} ecere_gcc_struct __anon1;
+} ecere_gcc_struct __anon2;
+} ecere_gcc_struct __anon1;
+} ecere_gcc_struct;
 
 struct __ecereNameSpace__ecere__com__DataMember
 {
@@ -1402,7 +1437,7 @@ struct __ecereNameSpace__ecere__sys__BinaryTree membersAlpha;
 int memberOffset;
 short structAlignment;
 short pointerAlignment;
-} __attribute__ ((gcc_struct));
+} ecere_gcc_struct;
 
 extern struct __ecereNameSpace__ecere__com__DataMember * __ecereNameSpace__ecere__com__eClass_FindDataMember(struct __ecereNameSpace__ecere__com__Class * _class, const char *  name, struct __ecereNameSpace__ecere__com__Instance * module, struct __ecereNameSpace__ecere__com__DataMember **  subMemberStack, int *  subMemberStackPos);
 
@@ -1463,7 +1498,7 @@ struct __ecereNameSpace__ecere__sys__OldList templatized;
 int numParams;
 unsigned int isInstanceClass;
 unsigned int byValueSystemClass;
-} __attribute__ ((gcc_struct));
+} ecere_gcc_struct;
 
 extern char *  __ecereNameSpace__ecere__com__PrintString(struct __ecereNameSpace__ecere__com__Class * class, const void * object, ...);
 
@@ -1604,7 +1639,7 @@ struct TemplateDatatype * templateDatatype;
 struct DBTableEntry * dbtableEntry;
 struct DBIndexItem * dbindexItem;
 struct DBTableDef * dbtableDef;
-} __attribute__ ((gcc_struct)) YYSTYPE;
+} ecere_gcc_struct YYSTYPE;
 
 extern YYSTYPE yylval;
 
@@ -1627,11 +1662,11 @@ struct
 {
 struct Identifier * id;
 struct Initializer * initializer;
-} __attribute__ ((gcc_struct)) __anon1;
-} __attribute__ ((gcc_struct)) __anon1;
+} ecere_gcc_struct __anon1;
+} ecere_gcc_struct __anon1;
 int memberAccess;
 void *  object;
-} __attribute__ ((gcc_struct));
+} ecere_gcc_struct;
 
 static void ProcessInitializer(struct Initializer *  init);
 
@@ -2348,7 +2383,10 @@ else if(exp->expType && exp->expType->kind == 8 && exp->expType->__anon1._class
 {
 struct __ecereNameSpace__ecere__sys__OldList * list = MkList();
 struct __ecereNameSpace__ecere__com__Class * _class;
+struct Statement * stmt;
 struct Expression * o;
+struct Statement * compound = MkCompoundStmt(MkListOne(MkDeclaration(MkListOne(MkSpecifier(VOID)), MkListOne(MkInitDeclarator(MkDeclaratorPointer(MkPointer((((void *)0)), (((void *)0))), MkDeclaratorIdentifier(MkIdentifier("__ecerePtrToDelete"))), MkInitializerAssignment(MkExpBrackets(args)))))), MkListOne(stmt = MkExpressionStmt(list)));
+struct Expression * stmtExp = MkExpExtensionCompound(compound);
 
 for(_class = exp->expType->__anon1._class->__anon1.registered; _class && _class->type == 5; _class = _class->base)
 {
@@ -2361,15 +2399,15 @@ FullClassNameCat(className, _class->fullName, 0);
 if(!_class->symbol)
 _class->symbol = FindClass(_class->fullName);
 DeclareClass(curExternal, _class->symbol, className);
-ListAdd(list, MkExpCondition(MkExpPointer(QMkExpId(className), MkIdentifier("Destructor")), MkListOne(MkExpCall(MkExpPointer(QMkExpId(className), MkIdentifier("Destructor")), MkListOne(MkExpCast(MkTypeName(MkListOne(MkSpecifier(VOID)), QMkPtrDecl((((void *)0)))), CopyExpression((*args).first))))), MkExpConstant("0")));
+ListAdd(list, MkExpCondition(MkExpPointer(QMkExpId(className), MkIdentifier("Destructor")), MkListOne(MkExpCall(MkExpPointer(QMkExpId(className), MkIdentifier("Destructor")), MkListOne(MkExpCast(MkTypeName(MkListOne(MkSpecifier(VOID)), QMkPtrDecl((((void *)0)))), MkExpIdentifier(MkIdentifier("__ecerePtrToDelete")))))), MkExpConstant("0")));
 }
-ListAdd(list, MkExpCall(QMkExpId("ecere::com::eSystem_Delete"), args));
+ListAdd(list, MkExpCall(QMkExpId("ecere::com::eSystem_Delete"), MkListOne(MkExpIdentifier(MkIdentifier("__ecerePtrToDelete")))));
 DeclareFunctionUtil(curExternal, "eSystem_Delete");
 o = CopyExpression(object);
 ProcessExpressionType(o);
 o->usage = (o->usage & ~0x1) | (((unsigned int)(1)) << 0);
 ProcessExpression(o);
-ListAdd(exp->__anon1.list, MkExpBrackets(MkListOne(MkExpCondition(o, MkListOne(MkExpBrackets(list)), MkExpConstant("0")))));
+ListAdd(exp->__anon1.list, MkExpBrackets(MkListOne(MkExpCondition(o, MkListOne(stmtExp), MkExpConstant("0")))));
 }
 else if(exp->expType && exp->expType->kind == 20)
 {
@@ -2522,7 +2560,11 @@ FreeType(exp->destType);
 *exp = *refExp;
 exp->prev = prev;
 exp->next = next;
-((refExp ? (__ecereClass_Expression->Destructor ? __ecereClass_Expression->Destructor((void *)refExp) : 0, __ecereNameSpace__ecere__com__eSystem_Delete(refExp)) : 0), refExp = 0);
+((refExp ? __extension__ ({
+void * __ecerePtrToDelete = (refExp);
+
+__ecereClass_Expression->Destructor ? __ecereClass_Expression->Destructor((void *)__ecerePtrToDelete) : 0, __ecereNameSpace__ecere__com__eSystem_Delete(__ecerePtrToDelete);
+}) : 0), refExp = 0);
 }
 if(exp->__anon1.op.op == '&' && !exp->__anon1.op.exp1 && exp->__anon1.op.exp2 && exp->__anon1.op.exp2->expType && exp->__anon1.op.exp2->expType->kind == 20 && !exp->__anon1.op.exp2->expType->passAsTemplate)
 {
@@ -2702,10 +2744,14 @@ struct Expression * e;
 unsigned int typedObject = 0;
 struct Type * ellipsisDestType = (((void *)0));
 unsigned int usedEllipsis = 0;
+struct Expression * expCallExp = exp->__anon1.call.exp;
+struct __ecereNameSpace__ecere__sys__OldList * arguments = exp->__anon1.call.arguments;
+unsigned int handleNullVMethod = 0;
+struct TypeName * typeName = (((void *)0));
 
-if(exp->__anon1.call.arguments)
+if(arguments)
 {
-for(e = (*exp->__anon1.call.arguments).first; e; e = e->next)
+for(e = (*arguments).first; e; e = e->next)
 {
 int __simpleStruct2, __simpleStruct3;
 int __simpleStruct0, __simpleStruct1;
@@ -2717,22 +2763,21 @@ ProcessExpression(e);
 exp->tempCount = (__simpleStruct2 = exp->tempCount, __simpleStruct3 = e->tempCount, (__simpleStruct2 > __simpleStruct3) ? __simpleStruct2 : __simpleStruct3);
 }
 }
-exp->__anon1.call.exp->usage = (exp->__anon1.call.exp->usage & ~0x1) | (((unsigned int)(1)) << 0);
-exp->__anon1.call.exp->usage = (exp->__anon1.call.exp->usage & ~0x8) | (((unsigned int)(1)) << 3);
-exp->__anon1.call.exp->tempCount = exp->tempCount;
-ProcessExpression(exp->__anon1.call.exp);
-if(exp->__anon1.call.exp->expType && exp->__anon1.call.exp->expType->kind == 16)
+expCallExp->usage = (expCallExp->usage & ~0x1) | (((unsigned int)(1)) << 0);
+expCallExp->usage = (expCallExp->usage & ~0x8) | (((unsigned int)(1)) << 3);
+expCallExp->tempCount = exp->tempCount;
+ProcessExpression(expCallExp);
+if(expCallExp->expType && expCallExp->expType->kind == 16)
 {
 unsigned int nullMemberExp = 0;
-struct Expression * memberExp = (exp->__anon1.call.exp->type == 8) ? exp->__anon1.call.exp : (((void *)0));
-struct __ecereNameSpace__ecere__com__Class * _class = exp->__anon1.call.exp->expType->__anon1.__anon3.methodClass;
-struct __ecereNameSpace__ecere__com__Class * argClass = exp->__anon1.call.exp->expType->__anon1.__anon3.methodClass;
-struct __ecereNameSpace__ecere__com__Method * method = exp->__anon1.call.exp->expType->__anon1.__anon3.method;
+struct Expression * memberExp = (expCallExp->type == 8) ? expCallExp : (((void *)0));
+struct __ecereNameSpace__ecere__com__Class * _class = expCallExp->expType->__anon1.__anon3.methodClass;
+struct __ecereNameSpace__ecere__com__Class * argClass = expCallExp->expType->__anon1.__anon3.methodClass;
+struct __ecereNameSpace__ecere__com__Method * method = expCallExp->expType->__anon1.__anon3.method;
 
 if(method->type == 1)
 {
 char name[1024];
-struct TypeName * typeName;
 struct Declarator * decl;
 struct Context * back;
 struct __ecereNameSpace__ecere__sys__OldList * specs = MkList();
@@ -2830,7 +2875,7 @@ struct Type * type = memberExp ? memberExp->__anon1.member.exp->expType : (((voi
 struct __ecereNameSpace__ecere__com__Class * regClass = (type && type->kind == 8 && type->__anon1._class) ? type->__anon1._class->__anon1.registered : (((void *)0));
 char className[1024];
 
-if(!exp->__anon1.call.exp->expType->__anon1.__anon3.methodClass && !_class && type && type->classObjectType)
+if(!expCallExp->expType->__anon1.__anon3.methodClass && !_class && type && type->classObjectType)
 strcpy(className, "class");
 else
 {
@@ -2842,7 +2887,7 @@ if(!cl)
 cl = regClass;
 if(!cl)
 cl = __ecereClass_int;
-if(cl->templateClass && !_class && exp->__anon1.call.exp->expType->__anon1._class && !exp->__anon1.call.exp->expType->__anon1.__anon3.methodClass && (type->kind == 19 || (regClass && regClass->type == 0 && strcmp(regClass->dataTypeString, "char *"))))
+if(cl->templateClass && !_class && expCallExp->expType->__anon1._class && !expCallExp->expType->__anon1.__anon3.methodClass && (type->kind == 19 || (regClass && regClass->type == 0 && strcmp(regClass->dataTypeString, "char *"))))
 cl = cl->templateClass;
 strcpy(className, "__ecereClass_");
 FullClassNameCat(className, cl->fullName, 1);
@@ -2850,29 +2895,34 @@ if(!cl->symbol)
 cl->symbol = FindClass(cl->fullName);
 DeclareClass(curExternal, cl->symbol, className);
 }
-if(type && type->kind == 19 && !_class && !exp->__anon1.call.exp->expType->__anon1.__anon3.methodClass && memberExp)
+if(type && type->kind == 19 && !_class && !expCallExp->expType->__anon1.__anon3.methodClass && memberExp)
 {
-exp->__anon1.call.exp = MkExpBrackets(MkListOne(MkExpCast(typeName, MkExpIndex(MkExpPointer(CopyExpression(memberExp->__anon1.member.exp), MkIdentifier("_vTbl")), MkListOne(MkExpIdentifier(MkIdentifier(name)))))));
+expCallExp = MkExpBrackets(MkListOne(MkExpCast(typeName, MkExpIndex(MkExpPointer(CopyExpression(memberExp->__anon1.member.exp), MkIdentifier("_vTbl")), MkListOne(MkExpIdentifier(MkIdentifier(name)))))));
+handleNullVMethod = 1;
 }
-else if(_class || exp->__anon1.call.exp->expType->__anon1.__anon3.methodClass || !memberExp || !regClass || regClass->type != 0 || !strcmp(regClass->dataTypeString, "char *"))
+else if(_class || expCallExp->expType->__anon1.__anon3.methodClass || !memberExp || !regClass || regClass->type != 0 || !strcmp(regClass->dataTypeString, "char *"))
 {
 if(!memberExp)
-FreeExpression(exp->__anon1.call.exp);
-exp->__anon1.call.exp = MkExpBrackets(MkListOne(MkExpCast(typeName, MkExpIndex(MkExpPointer(MkExpIdentifier(MkIdentifier(className)), MkIdentifier("_vTbl")), MkListOne(MkExpIdentifier(MkIdentifier(name)))))));
+FreeExpression(expCallExp);
+expCallExp = MkExpBrackets(MkListOne(MkExpCast(typeName, MkExpIndex(MkExpPointer(MkExpIdentifier(MkIdentifier(className)), MkIdentifier("_vTbl")), MkListOne(MkExpIdentifier(MkIdentifier(name)))))));
+handleNullVMethod = 1;
 }
 else
 {
-struct Expression * c;
+struct Expression * vTblExp;
 struct Context * context = PushContext();
 struct __ecereNameSpace__ecere__sys__OldList * specs;
+struct __ecereNameSpace__ecere__sys__OldList * declList = MkListOne(MkDeclaration((specs = MkListOne(MkSpecifierName("Instance"))), MkListOne(MkInitDeclarator(MkDeclaratorIdentifier(MkIdentifier("__internal_ClassInst")), MkInitializerAssignment(CopyExpression(memberExp->__anon1.member.exp))))));
+struct __ecereNameSpace__ecere__sys__OldList * stmtList = MkListOne(MkExpressionStmt(MkListOne(MkExpCondition(MkExpIdentifier(MkIdentifier("__internal_ClassInst")), MkListOne(MkExpPointer(MkExpIdentifier(MkIdentifier("__internal_ClassInst")), MkIdentifier("_vTbl"))), MkExpPointer(MkExpIdentifier(MkIdentifier(className)), MkIdentifier("_vTbl"))))));
 
-c = MkExpExtensionCompound(MkCompoundStmt(MkListOne(MkDeclaration((specs = MkListOne(MkSpecifierName("Instance"))), MkListOne(MkInitDeclarator(MkDeclaratorIdentifier(MkIdentifier("__internal_ClassInst")), MkInitializerAssignment(CopyExpression(memberExp->__anon1.member.exp)))))), MkListOne(MkExpressionStmt(MkListOne(MkExpCondition(MkExpIdentifier(MkIdentifier("__internal_ClassInst")), MkListOne(MkExpPointer(MkExpIdentifier(MkIdentifier("__internal_ClassInst")), MkIdentifier("_vTbl"))), MkExpPointer(MkExpIdentifier(MkIdentifier(className)), MkIdentifier("_vTbl"))))))));
+vTblExp = MkExpExtensionCompound(MkCompoundStmt(declList, stmtList));
 if(__ecereProp_Type_Get_specConst(type))
 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*specs), (((void *)0)), MkSpecifier(CONST));
-c->loc = exp->loc;
-c->__anon1.compound->__anon1.compound.context = context;
+vTblExp->loc = exp->loc;
+vTblExp->__anon1.compound->__anon1.compound.context = context;
 PopContext(context);
-exp->__anon1.call.exp = MkExpBrackets(MkListOne(MkExpCast(typeName, MkExpIndex(c, MkListOne(MkExpIdentifier(MkIdentifier(name)))))));
+expCallExp = MkExpBrackets(MkListOne(MkExpCast(typeName, MkExpIndex(vTblExp, MkListOne(MkExpIdentifier(MkIdentifier(name)))))));
+handleNullVMethod = 1;
 }
 }
 }
@@ -2885,12 +2935,12 @@ FullClassNameCat(name, method->_class->fullName, 0);
 strcat(name, "_");
 strcat(name, method->name);
 if(!memberExp)
-FreeExpression(exp->__anon1.call.exp);
-exp->__anon1.call.exp = MkExpIdentifier(MkIdentifier(name));
+FreeExpression(expCallExp);
+expCallExp = MkExpIdentifier(MkIdentifier(name));
 DeclareMethod(curExternal, method, name);
 if(memberExp && memberExp->expType && method->dataType)
 {
-exp->__anon1.call.exp->expType = method->dataType;
+expCallExp->expType = method->dataType;
 method->dataType->refCount++;
 }
 }
@@ -2898,32 +2948,39 @@ if(memberExp && (!memberExp->__anon1.member.exp || !memberExp->__anon1.member.ex
 {
 if(method->dataType && !method->dataType->__anon1.__anon2.staticMethod && !method->dataType->extraParam)
 {
-if(!exp->__anon1.call.arguments)
-exp->__anon1.call.arguments = MkList();
+if(!arguments)
+arguments = MkList();
 if(typedObject && memberExp->__anon1.member.exp && memberExp->__anon1.member.exp->expType)
 {
 unsigned int changeReference = 0;
+unsigned int stillAddReferenceOp = 0;
 struct Expression * memberExpMemberExp = CopyExpression(memberExp->__anon1.member.exp);
+struct Type * expType = memberExp->__anon1.member.exp->expType;
+struct __ecereNameSpace__ecere__com__Class * c = expType->kind == 8 && expType->__anon1._class ? expType->__anon1._class->__anon1.registered : (((void *)0));
 
 if(argClass && (argClass->type == 4 || argClass->type == 3 || argClass->type == 2 || argClass->type == 1000) && strcmp(argClass->fullName, "class") && strcmp(argClass->fullName, "uintptr") && strcmp(argClass->fullName, "intptr"))
 changeReference = 1;
-if(!memberExp->__anon1.member.exp->expType->classObjectType && ((((memberExp->__anon1.member.exp->expType->kind != 13 && (memberExp->__anon1.member.exp->expType->kind != 8 || !memberExp->__anon1.member.exp->expType->__anon1._class || !memberExp->__anon1.member.exp->expType->__anon1._class->__anon1.registered || memberExp->__anon1.member.exp->expType->__anon1._class->__anon1.registered->type == 1)))) || method->dataType->byReference))
+if(!expType->classObjectType && (((expType->kind != 13 && (!c || c->type == 1))) || method->dataType->byReference))
+{
+if(c && (c->type == 0 || c->type == 5))
+stillAddReferenceOp = 1;
 changeReference = 1;
-if(typedObject && memberExp->__anon1.member.exp->expType->classObjectType && memberExp->__anon1.member.exp->expType->byReference != method->dataType->byReference)
+}
+if(typedObject && expType->classObjectType && expType->byReference != method->dataType->byReference)
 changeReference = 1;
 if(changeReference)
 {
 if(memberExp->__anon1.member.exp->type == 5 && memberExp->__anon1.member.exp->__anon1.list && (*memberExp->__anon1.member.exp->__anon1.list).count == 1 && ((struct Expression *)(*memberExp->__anon1.member.exp->__anon1.list).first)->type == 4 && ((struct Expression *)(*memberExp->__anon1.member.exp->__anon1.list).first)->__anon1.op.op == '*' && !((struct Expression *)(*memberExp->__anon1.member.exp->__anon1.list).first)->__anon1.op.exp1)
 {
-__ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*exp->__anon1.call.arguments), (((void *)0)), ((struct Expression *)(*memberExp->__anon1.member.exp->__anon1.list).first)->__anon1.op.exp2);
+__ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*arguments), (((void *)0)), ((struct Expression *)(*memberExp->__anon1.member.exp->__anon1.list).first)->__anon1.op.exp2);
 ((struct Expression *)(*memberExp->__anon1.member.exp->__anon1.list).first)->__anon1.op.exp2 = (((void *)0));
 }
 else if(memberExp->__anon1.member.exp->type == 4 && memberExp->__anon1.member.exp->__anon1.op.op == '*' && !memberExp->__anon1.member.exp->__anon1.op.exp1)
 {
-__ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*exp->__anon1.call.arguments), (((void *)0)), memberExp->__anon1.member.exp->__anon1.op.exp2);
+__ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*arguments), (((void *)0)), memberExp->__anon1.member.exp->__anon1.op.exp2);
 memberExp->__anon1.member.exp->__anon1.op.exp2 = (((void *)0));
 }
-else if(!memberExp->__anon1.member.exp->byReference)
+else if(!memberExp->__anon1.member.exp->byReference || stillAddReferenceOp)
 {
 struct Expression * checkedExp = memberExp->__anon1.member.exp;
 struct Expression * parentExp = (((void *)0));
@@ -2954,7 +3011,13 @@ disconnected = 1;
 }
 if(!parentExp)
 nullMemberExp = 1;
-newExp = (typedObject && !memberExp->__anon1.member.exp->expType->classObjectType) ? checkedExp : MkExpOp((((void *)0)), '&', checkedExp);
+if(typedObject && !expType->classObjectType && !stillAddReferenceOp)
+newExp = checkedExp;
+else
+{
+newExp = MkExpOp((((void *)0)), '&', checkedExp);
+newExp->byReference = 1;
+}
 if(parentExp && (parentExp->type == 5 || parentExp->type == 32))
 {
 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Remove((&*parentExp->__anon1.list), checkedExp);
@@ -2966,7 +3029,7 @@ parentExp->__anon1.cast.exp = newExp;
 if(newExp->expType && newExp->expType->classObjectType)
 parentExp->__anon1.cast.typeName->declarator = MkDeclaratorPointer(MkPointer((((void *)0)), (((void *)0))), parentExp->__anon1.cast.typeName->declarator);
 }
-if(typedObject && !memberExp->__anon1.member.exp->expType->classObjectType)
+if(typedObject && !expType->classObjectType)
 {
 struct Type * destType = (destType = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Type), destType->refCount = 1, destType->kind = 8, destType->classObjectType = 3, destType);
 
@@ -2977,17 +3040,17 @@ FreeType((parentExp ? parentExp : newExp)->destType);
 if(checkedExp->expType)
 checkedExp->expType->refCount++;
 }
-__ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*exp->__anon1.call.arguments), (((void *)0)), parentExp ? parentExp : newExp);
+__ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*arguments), (((void *)0)), parentExp ? parentExp : newExp);
 }
 else
 {
-__ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*exp->__anon1.call.arguments), (((void *)0)), memberExp->__anon1.member.exp);
+__ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*arguments), (((void *)0)), memberExp->__anon1.member.exp);
 nullMemberExp = 1;
 }
 }
 else
 {
-__ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*exp->__anon1.call.arguments), (((void *)0)), memberExp->__anon1.member.exp);
+__ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*arguments), (((void *)0)), memberExp->__anon1.member.exp);
 nullMemberExp = 1;
 }
 {
@@ -2996,7 +3059,7 @@ struct Type * type = memberExp->__anon1.member.exp ? memberExp->__anon1.member.e
 struct __ecereNameSpace__ecere__com__Class * regClass = (type && type->kind == 8 && type->__anon1._class) ? type->__anon1._class->__anon1.registered : (((void *)0));
 struct __ecereNameSpace__ecere__com__Class * cl = argClass ? argClass : regClass;
 
-className[0] = (char)0;
+className[0] = 0;
 if(memberExp->__anon1.member.exp && memberExp->__anon1.member.exp->expType && memberExp->__anon1.member.exp->expType->classObjectType == 2)
 strcpy(className, "class");
 else if(cl)
@@ -3020,11 +3083,11 @@ c->__anon1.compound->__anon1.compound.context = context;
 PopContext(context);
 if(__ecereProp_Type_Get_specConst(type))
 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*specs), (((void *)0)), MkSpecifier(CONST));
-__ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*exp->__anon1.call.arguments), (((void *)0)), c);
+__ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*arguments), (((void *)0)), c);
 memberExpMemberExp = (((void *)0));
 }
 else
-__ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*exp->__anon1.call.arguments), (((void *)0)), MkExpIdentifier(MkIdentifier(className)));
+__ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*arguments), (((void *)0)), MkExpIdentifier(MkIdentifier(className)));
 }
 }
 if(memberExpMemberExp)
@@ -3032,7 +3095,7 @@ FreeExpression(memberExpMemberExp);
 }
 else
 {
-__ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*exp->__anon1.call.arguments), (((void *)0)), memberExp->__anon1.member.exp);
+__ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*arguments), (((void *)0)), memberExp->__anon1.member.exp);
 nullMemberExp = 1;
 }
 }
@@ -3044,9 +3107,9 @@ memberExp->__anon1.member.exp = (((void *)0));
 FreeExpression(memberExp);
 }
 }
-if(exp->__anon1.call.arguments)
+if(arguments)
 {
-for(e = (*exp->__anon1.call.arguments).first; e; e = e->next)
+for(e = (*arguments).first; e; e = e->next)
 {
 struct Type * destType = (e->destType && e->destType->kind == 14) ? ellipsisDestType : e->destType;
 
@@ -3128,8 +3191,8 @@ newExp = MkExpBrackets(MkListOne(MkExpOp(MkExpCast(MkTypeName(MkListOne(MkSpecif
 }
 if(parentExp->type == 7)
 {
-__ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*exp->__anon1.call.arguments), e->prev, newExp);
-__ecereMethod___ecereNameSpace__ecere__sys__OldList_Remove((&*exp->__anon1.call.arguments), e);
+__ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*arguments), e->prev, newExp);
+__ecereMethod___ecereNameSpace__ecere__sys__OldList_Remove((&*arguments), e);
 e = newExp;
 }
 else if(parentExp->type == 5 || parentExp->type == 32)
@@ -3154,7 +3217,11 @@ __ecereMethod___ecereNameSpace__ecere__sys__OldList_Add((&*((struct Statement *)
 e->byReference = 1;
 FreeType(checkedExp->expType);
 FreeType(checkedExp->destType);
-((checkedExp ? (__ecereClass_Expression->Destructor ? __ecereClass_Expression->Destructor((void *)checkedExp) : 0, __ecereNameSpace__ecere__com__eSystem_Delete(checkedExp)) : 0), checkedExp = 0);
+((checkedExp ? __extension__ ({
+void * __ecerePtrToDelete = (checkedExp);
+
+__ecereClass_Expression->Destructor ? __ecereClass_Expression->Destructor((void *)__ecerePtrToDelete) : 0, __ecereNameSpace__ecere__com__eSystem_Delete(__ecerePtrToDelete);
+}) : 0), checkedExp = 0);
 }
 else if((!e->byReference && (!e->expType || !e->expType->classObjectType)) || (_class && _class->type == 5))
 {
@@ -3231,8 +3298,8 @@ newExp->byReference = 1;
 }
 if(parentExp->type == 7)
 {
-__ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*exp->__anon1.call.arguments), e->prev, newExp);
-__ecereMethod___ecereNameSpace__ecere__sys__OldList_Remove((&*exp->__anon1.call.arguments), e);
+__ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*arguments), e->prev, newExp);
+__ecereMethod___ecereNameSpace__ecere__sys__OldList_Remove((&*arguments), e);
 e = newExp;
 }
 else if(parentExp->type == 5 || parentExp->type == 32)
@@ -3277,7 +3344,7 @@ struct Context * context = PushContext();
 
 if(_class->templateClass && !strcmp(_class->templateClass->name, "Container") && e->__anon1.list && (*e->__anon1.list).first && ((struct Expression *)(*e->__anon1.list).first)->type == 11 && ((struct Expression *)(*e->__anon1.list).first)->__anon1.cast.exp && ((struct Expression *)(*e->__anon1.list).first)->__anon1.cast.exp->type == 4 && ((struct Expression *)(*e->__anon1.list).first)->__anon1.cast.exp->__anon1.op.op == '&' && ((struct Expression *)(*e->__anon1.list).first)->__anon1.cast.exp->__anon1.op.exp2 && ((struct Expression *)(*e->__anon1.list).first)->__anon1.cast.exp->__anon1.op.exp2->type == 33)
 {
-__ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*exp->__anon1.call.arguments), e->prev, MkExpIdentifier(MkIdentifier(className)));
+__ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*arguments), e->prev, MkExpIdentifier(MkIdentifier(className)));
 }
 else
 {
@@ -3288,11 +3355,11 @@ c->__anon1.compound->__anon1.compound.context = context;
 PopContext(context);
 if(__ecereProp_Type_Get_specConst(type))
 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*specs), (((void *)0)), MkSpecifier(CONST));
-__ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*exp->__anon1.call.arguments), e->prev, c);
+__ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*arguments), e->prev, c);
 }
 }
 else
-__ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*exp->__anon1.call.arguments), e->prev, MkExpIdentifier(MkIdentifier(className)));
+__ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*arguments), e->prev, MkExpIdentifier(MkIdentifier(className)));
 }
 }
 }
@@ -3302,11 +3369,59 @@ FixReference(e, !destType || !destType->declaredWithStruct);
 }
 if(ellipsisDestType)
 {
-if(usedEllipsis || (exp->__anon1.call.exp->expType && exp->__anon1.call.exp->expType->kind == 11 && exp->__anon1.call.exp->expType->__anon1.__anon2.params.last && ((struct Type *)exp->__anon1.call.exp->expType->__anon1.__anon2.params.last)->kind == 14))
+if(usedEllipsis || (expCallExp->expType && expCallExp->expType->kind == 11 && expCallExp->expType->__anon1.__anon2.params.last && ((struct Type *)expCallExp->expType->__anon1.__anon2.params.last)->kind == 14))
+{
+__ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*arguments), (*arguments).last, MkExpCast(MkTypeName(MkListOne(MkSpecifier(VOID)), MkDeclaratorPointer(MkPointer((((void *)0)), (((void *)0))), (((void *)0)))), MkExpConstant("0")));
+}
+}
+}
+if(handleNullVMethod)
+{
+struct Expression * compoundExp;
+struct Context * context = PushContext();
+struct __ecereNameSpace__ecere__sys__OldList * declList = MkList();
+struct __ecereNameSpace__ecere__sys__OldList * stmtList = MkList();
+struct TypeName * castTypeName;
+struct __ecereNameSpace__ecere__sys__OldList * specs = MkList();
+struct Specifier * spec;
+
+for(spec = typeName->qualifiers ? (*typeName->qualifiers).first : (((void *)0)); spec; spec = spec->next)
+{
+if(spec->type != 5)
+__ecereMethod___ecereNameSpace__ecere__sys__OldList_Add((&*specs), CopySpecifier(spec));
+}
+if(typeName->declarator->type == 5)
+{
+struct Pointer * p = typeName->declarator->__anon1.pointer.pointer->pointer;
+
+castTypeName = MkTypeName(specs, CopyDeclarator(typeName->declarator->declarator->declarator->declarator));
+while(p)
 {
-__ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*exp->__anon1.call.arguments), (*exp->__anon1.call.arguments).last, MkExpCast(MkTypeName(MkListOne(MkSpecifier(VOID)), MkDeclaratorPointer(MkPointer((((void *)0)), (((void *)0))), (((void *)0)))), MkExpConstant("0")));
+struct Pointer * pp;
+
+for(pp = castTypeName->declarator->__anon1.pointer.pointer; pp->pointer; pp = pp->pointer)
+;
+pp->pointer = MkPointer((((void *)0)), (((void *)0)));
+pp->qualifiers = CopyList(p->qualifiers, (void *)(CopySpecifier));
+p = p->pointer;
 }
 }
+else
+castTypeName = MkTypeName(specs, CopyDeclarator(typeName->declarator->declarator->declarator->declarator));
+compoundExp = MkExpExtensionCompound(MkCompoundStmt(declList, stmtList));
+__ecereMethod___ecereNameSpace__ecere__sys__OldList_Add((&*declList), MkDeclaration(CopyList(typeName->qualifiers, (void *)(CopySpecifier)), MkListOne(MkInitDeclarator(PlugDeclarator(CopyDeclarator(typeName->declarator), MkDeclaratorIdentifier(MkIdentifier("__internal_VirtualMethod"))), (((void *)0))))));
+__ecereMethod___ecereNameSpace__ecere__sys__OldList_Add((&*stmtList), MkExpressionStmt(MkListOne(MkExpOp(MkExpIdentifier(MkIdentifier("__internal_VirtualMethod")), '=', expCallExp))));
+__ecereMethod___ecereNameSpace__ecere__sys__OldList_Add((&*stmtList), MkExpressionStmt(MkListOne(MkExpCondition(MkExpIdentifier(MkIdentifier("__internal_VirtualMethod")), MkListOne(MkExpCall(MkExpIdentifier(MkIdentifier("__internal_VirtualMethod")), arguments)), MkExpCast(castTypeName, MkExpConstant("1"))))));
+compoundExp->loc = exp->loc;
+compoundExp->__anon1.compound->__anon1.compound.context = context;
+PopContext(context);
+exp->type = 5;
+exp->__anon1.list = MkListOne(compoundExp);
+}
+else
+{
+exp->__anon1.call.exp = expCallExp;
+exp->__anon1.call.arguments = arguments;
 }
 break;
 }
@@ -3465,7 +3580,7 @@ struct Declaration * decl;
 struct __ecereNameSpace__ecere__sys__OldList * specs = MkList(), * decls = MkList();
 struct Expression * tempExp;
 
-className[0] = (char)0;
+className[0] = 0;
 FullClassNameCat(className, propertyClass->fullName, 0);
 DeclareStruct(curExternal, propertyClass->fullName, 0, 1);
 ListAdd(specs, MkStructOrUnion(3, MkIdentifier(className), (((void *)0))));
@@ -3546,7 +3661,7 @@ char typeString[2048];
 struct __ecereNameSpace__ecere__sys__OldList * specs = MkList();
 struct Declarator * decl;
 
-typeString[0] = (char)0;
+typeString[0] = 0;
 PrintType(exp->expType, typeString, 0, 0);
 decl = SpecDeclFromString(typeString, specs, (((void *)0)));
 exp->__anon1.cast.typeName = MkTypeName(specs, decl);
@@ -3723,7 +3838,7 @@ if(!member->_class->symbol)
 member->_class->symbol = FindClass(member->_class->fullName);
 DeclareClass(curExternal, member->_class->symbol, className);
 DeclareStruct(curExternal, member->_class->fullName, 0, 1);
-structName[0] = (char)0;
+structName[0] = 0;
 FullClassNameCat(structName, member->_class->fullName, 0);
 checkedExp = exp->__anon1.member.exp;
 while(((checkedExp->type == 5 || checkedExp->type == 32) && checkedExp->__anon1.list && (*checkedExp->__anon1.list).count == 1) || checkedExp->type == 11)