Fix C code where a typedef name was used for constructor and destructor names in %extend. Deprecate use of typedef names for constructor and destructor names going forwards.

This commit is contained in:
William S Fulton 2013-02-18 08:40:20 +00:00
commit d1b40b468b
6 changed files with 65 additions and 2 deletions

View file

@ -33,3 +33,28 @@ typedef struct StructD StructDName;
void method() {}
}
typedef struct stru_struct {
int bar;
} stru;
typedef union uni_union {
int un1;
double un2;
} uni;
%extend stru {
stru() {
stru* s = (stru*)malloc(sizeof(stru));
s->bar = 11;
return s;
}
~stru() {
free($self);
}
}
%extend uni {
uni() { return 0; }
~uni() { free($self); }
}