Fixes for classes with the same name in different namespaces
Includes the majority of patch #1484. Excludes changes in typepass.cxx for specializations which have no effect on the duplicate_class_name_in_ns testcase, nor the rest of the test-suite.
This commit is contained in:
parent
ee9e436971
commit
fa00622614
4 changed files with 109 additions and 5 deletions
|
|
@ -223,6 +223,7 @@ CPP_TEST_CASES += \
|
|||
director_void \
|
||||
director_wombat \
|
||||
disown \
|
||||
duplicate_class_name_in_ns \
|
||||
dynamic_cast \
|
||||
empty \
|
||||
enum_ignore \
|
||||
|
|
|
|||
88
Examples/test-suite/duplicate_class_name_in_ns.i
Normal file
88
Examples/test-suite/duplicate_class_name_in_ns.i
Normal file
|
|
@ -0,0 +1,88 @@
|
|||
%module duplicate_class_name_in_ns
|
||||
|
||||
%rename(XA) A::X;
|
||||
%rename(XB) B::X;
|
||||
|
||||
%inline %{
|
||||
|
||||
namespace A
|
||||
{
|
||||
class X
|
||||
{
|
||||
public:
|
||||
X(){};
|
||||
};
|
||||
|
||||
template<typename T>
|
||||
class Foo
|
||||
{
|
||||
public:
|
||||
Foo(){};
|
||||
};
|
||||
|
||||
class Bar
|
||||
{
|
||||
public:
|
||||
Bar(){};
|
||||
};
|
||||
|
||||
template<typename T>
|
||||
class Baz
|
||||
{
|
||||
public:
|
||||
Baz(){};
|
||||
};
|
||||
}
|
||||
|
||||
namespace B
|
||||
{
|
||||
// non-template derived from non-template
|
||||
class X : public A::X
|
||||
{
|
||||
public:
|
||||
X(){};
|
||||
A::X do_x(){return A::X();}
|
||||
};
|
||||
|
||||
// template derived from template with different template args
|
||||
template<typename T, typename U>
|
||||
class Foo : public A::Foo<U>
|
||||
{
|
||||
public:
|
||||
Foo(){};
|
||||
A::Foo<U> do_foo(){return A::Foo<U>();}
|
||||
};
|
||||
|
||||
// template derived from non-template
|
||||
template<typename T, typename U>
|
||||
class Bar : public A::Bar
|
||||
{
|
||||
public:
|
||||
Bar(){};
|
||||
A::Bar do_bar(){return A::Bar();}
|
||||
};
|
||||
|
||||
// template derived from template with same template args
|
||||
template<typename T>
|
||||
class Baz : public A::Baz<T>
|
||||
{
|
||||
public:
|
||||
Baz(){};
|
||||
A::Baz<T> do_baz(){return A::Baz<T>();}
|
||||
};
|
||||
}
|
||||
|
||||
%}
|
||||
|
||||
%template(AFoo) A::Foo<double>;
|
||||
%template(ABaz) A::Baz<double>;
|
||||
%template(BFoo) B::Foo<int, double>;
|
||||
%template(BBar) B::Bar<int, double>;
|
||||
%template(BBaz) B::Baz<double>;
|
||||
|
||||
%inline %{
|
||||
A::X get_a_x() {B::X x; return x.do_x();}
|
||||
A::Foo<double> get_a_foo() {B::Foo<int, double> x; return x.do_foo();}
|
||||
A::Bar get_a_bar() {B::Bar<int, double> x; return x.do_bar();}
|
||||
A::Baz<double> get_a_baz() {B::Baz<double> x; return x.do_baz();}
|
||||
%}
|
||||
Loading…
Add table
Add a link
Reference in a new issue