mirror of https://github.com/swig/swig
parent
5a22bcf007
commit
c39a379942
|
@ -7,6 +7,10 @@ the issue number to the end of the URL: https://github.com/swig/swig/issues/
|
|||
Version 4.0.0 (in progress)
|
||||
===========================
|
||||
|
||||
2018-08-20: wkalinin
|
||||
#1305 Fix nested structure symbol tables in C mode to fix member name conflicts
|
||||
in different structs with the same nested struct member name.
|
||||
|
||||
2018-08-12: gmazzamuto
|
||||
[Python] #1283 Update pybuffer.i library to use new-style Python buffer C API.
|
||||
|
||||
|
|
|
@ -114,4 +114,50 @@ typedef struct OutSt {
|
|||
|
||||
#endif
|
||||
|
||||
%inline %{
|
||||
typedef struct {
|
||||
union x_union {
|
||||
int x;
|
||||
} duplicate_p;
|
||||
} x_t;
|
||||
|
||||
typedef struct {
|
||||
union y_union {
|
||||
int y;
|
||||
} duplicate_p;
|
||||
} y_t;
|
||||
|
||||
typedef struct A {
|
||||
union a_union {
|
||||
int a;
|
||||
} duplicate_p;
|
||||
} a_t;
|
||||
|
||||
typedef struct B {
|
||||
union b_union {
|
||||
int b;
|
||||
} duplicate_p;
|
||||
} b_t;
|
||||
|
||||
typedef struct {
|
||||
union {
|
||||
int c;
|
||||
} duplicate_p;
|
||||
} c_t;
|
||||
|
||||
typedef struct {
|
||||
union {
|
||||
int d;
|
||||
} duplicate_p;
|
||||
} d_t;
|
||||
|
||||
void set_union_values(int startval, x_t *x, y_t *y, a_t *a, b_t *b, c_t *c, d_t *d) {
|
||||
x->duplicate_p.x = startval++;
|
||||
y->duplicate_p.y = startval++;
|
||||
a->duplicate_p.a = startval++;
|
||||
b->duplicate_p.b = startval++;
|
||||
c->duplicate_p.c = startval++;
|
||||
d->duplicate_p.d = startval++;
|
||||
}
|
||||
%}
|
||||
|
||||
|
|
|
@ -0,0 +1,20 @@
|
|||
from nested import *
|
||||
|
||||
def check(a, b):
|
||||
if a != b:
|
||||
raise RuntimeError("Problem: {} != {}".format(a, b))
|
||||
xx = x_t()
|
||||
yy = y_t()
|
||||
aa = a_t()
|
||||
bb = b_t()
|
||||
cc = c_t()
|
||||
dd = d_t()
|
||||
|
||||
set_union_values(100, xx, yy, aa, bb, cc, dd)
|
||||
|
||||
check(xx.duplicate_p.x, 100)
|
||||
check(yy.duplicate_p.y, 101)
|
||||
check(aa.duplicate_p.a, 102)
|
||||
check(bb.duplicate_p.b, 103)
|
||||
check(cc.duplicate_p.c, 104)
|
||||
check(dd.duplicate_p.d, 105)
|
Loading…
Reference in New Issue