Typedef typedef prefix test for templates
As given in Diorcet Yann's example in issue #50
This commit is contained in:
parent
c319ad9dd6
commit
2f47bb8d67
3 changed files with 70 additions and 0 deletions
|
|
@ -424,6 +424,7 @@ CPP_TEST_CASES += \
|
||||||
template_typedef_ns \
|
template_typedef_ns \
|
||||||
template_typedef_ptr \
|
template_typedef_ptr \
|
||||||
template_typedef_rec \
|
template_typedef_rec \
|
||||||
|
template_typedef_typedef \
|
||||||
template_typemaps \
|
template_typemaps \
|
||||||
template_typemaps_typedef \
|
template_typemaps_typedef \
|
||||||
template_typemaps_typedef2 \
|
template_typemaps_typedef2 \
|
||||||
|
|
|
||||||
26
Examples/test-suite/java/template_typedef_typedef_runme.java
Normal file
26
Examples/test-suite/java/template_typedef_typedef_runme.java
Normal file
|
|
@ -0,0 +1,26 @@
|
||||||
|
import template_typedef_typedef.*;
|
||||||
|
|
||||||
|
public class template_typedef_typedef_runme {
|
||||||
|
|
||||||
|
static {
|
||||||
|
try {
|
||||||
|
System.loadLibrary("template_typedef_typedef");
|
||||||
|
} catch (UnsatisfiedLinkError e) {
|
||||||
|
System.err.println("Native code library failed to load. See the chapter on Dynamic Linking Problems in the SWIG Java documentation for help.\n" + e);
|
||||||
|
System.exit(1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void main(String argv[]) {
|
||||||
|
ObjectBase ob1 = new ObjectBase();
|
||||||
|
ob1.getBlabla1(new ObjectBase());
|
||||||
|
Object2Base ob2 = new Object2Base();
|
||||||
|
ob2.getBlabla2(new Object2Base());
|
||||||
|
|
||||||
|
Factory factory = new Factory();
|
||||||
|
factory.getBlabla3(new ObjectBase());
|
||||||
|
factory.getBlabla4(new Object2Base());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
43
Examples/test-suite/template_typedef_typedef.i
Normal file
43
Examples/test-suite/template_typedef_typedef.i
Normal file
|
|
@ -0,0 +1,43 @@
|
||||||
|
%module template_typedef_typedef
|
||||||
|
|
||||||
|
// Github issue #50
|
||||||
|
// The Object2::getBlabla2 and Object::getBlabla1 functions were not resolving to the correct template types
|
||||||
|
|
||||||
|
%inline%{
|
||||||
|
|
||||||
|
class Factory;
|
||||||
|
class Base {
|
||||||
|
public:
|
||||||
|
typedef Factory ABCD;
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
namespace TT{
|
||||||
|
template <typename T>
|
||||||
|
class Object2:public T {
|
||||||
|
public:
|
||||||
|
void getBlabla2(typename T::ABCD::CC2 c) {
|
||||||
|
};
|
||||||
|
};
|
||||||
|
template <typename T>
|
||||||
|
class Object:public T {
|
||||||
|
public:
|
||||||
|
void getBlabla1(typename T::ABCD::CC1 c) {
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
class Factory {
|
||||||
|
public:
|
||||||
|
typedef TT::Object<Base> CC1;
|
||||||
|
typedef TT::Object2<Base> CC2;
|
||||||
|
void getBlabla4(CC2 c) {
|
||||||
|
};
|
||||||
|
void getBlabla3(CC1 c) {
|
||||||
|
};
|
||||||
|
};
|
||||||
|
%}
|
||||||
|
|
||||||
|
%template(ObjectBase) TT::Object<Base>;
|
||||||
|
%template(Object2Base) TT::Object2<Base>;
|
||||||
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue