better handling of using directives

This commit is contained in:
Frank Schlimbach 2019-02-26 07:27:12 -06:00 committed by Olly Betts
commit 63452e9fc1
6 changed files with 100 additions and 3 deletions

View file

@ -549,6 +549,7 @@ CPP_TEST_CASES += \
using_directive_and_declaration_forward \
using_extend \
using_inherit \
using_member \
using_namespace \
using_namespace_loop \
using_pointers \

View file

@ -0,0 +1,10 @@
from using_member import *
b = B()
assert b.get(int(1)) == 10
assert b.get(float(1)) == 20
bb = BB()
assert bb.greater(int(1)) == 0
assert bb.greater(float(1)) == 1
assert bb.great(True) == 2

View file

@ -0,0 +1,52 @@
%module using_member;
%rename(greater) one::two::three::interface1::AA::great(int);
%rename(greater) one::two::three::interface1::AA::great(float);
%inline %{
namespace interface1
{
class A
{
public:
int get(int) {return 10;}
};
}
using interface1::A;
class B : public A
{
public:
using A::get;
int get(double) {return 20;}
};
namespace one {
namespace two {
namespace three {
namespace interface1
{
class AA
{
public:
int great(int) {return 0;}
int great(float) {return 1;}
};
}
using interface1::AA;
}
}
namespace twotwo {
namespace threetwo {
class BB : public two::three::AA
{
public:
using two::three::AA::great;
int great(bool) {return 2;}
int jj() {return 3;};
};
}
}
}
%}