Add testcase for bug #3378145 which was fixed in r12764
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@12765 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
parent
7d038d4bd7
commit
4511b13646
4 changed files with 77 additions and 0 deletions
|
|
@ -32,6 +32,8 @@ Version 2.0.5 (in progress)
|
||||||
All symbols within Map will be resolved correctly, eg key_type and mapped_type no matter if the
|
All symbols within Map will be resolved correctly, eg key_type and mapped_type no matter if the
|
||||||
wrapped code uses Std::Map<int, double> or std::Map<int, DOUBLE> or Std::Map<int, double, int>
|
wrapped code uses Std::Map<int, double> or std::Map<int, DOUBLE> or Std::Map<int, double, int>
|
||||||
|
|
||||||
|
Also fixes bug #3378145 - regression introduced in 2.0.4 - %template using traits.
|
||||||
|
|
||||||
2011-07-20 szager
|
2011-07-20 szager
|
||||||
[python] Fix closure for tp_call slot.
|
[python] Fix closure for tp_call slot.
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -390,6 +390,7 @@ CPP_TEST_CASES += \
|
||||||
template_typedef_cplx4 \
|
template_typedef_cplx4 \
|
||||||
template_typedef_cplx5 \
|
template_typedef_cplx5 \
|
||||||
template_typedef_funcptr \
|
template_typedef_funcptr \
|
||||||
|
template_typedef_inherit \
|
||||||
template_typedef_ns \
|
template_typedef_ns \
|
||||||
template_typedef_ptr \
|
template_typedef_ptr \
|
||||||
template_typedef_rec \
|
template_typedef_rec \
|
||||||
|
|
|
||||||
24
Examples/test-suite/java/template_typedef_inherit_runme.java
Normal file
24
Examples/test-suite/java/template_typedef_inherit_runme.java
Normal file
|
|
@ -0,0 +1,24 @@
|
||||||
|
|
||||||
|
|
||||||
|
import template_typedef_inherit.*;
|
||||||
|
|
||||||
|
public class template_typedef_inherit_runme {
|
||||||
|
|
||||||
|
static {
|
||||||
|
try {
|
||||||
|
System.loadLibrary("template_typedef_inherit");
|
||||||
|
} 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[]) {
|
||||||
|
DescriptionImplementationTypedCollectionInterfaceObject d = new DescriptionImplementationTypedCollectionInterfaceObject();
|
||||||
|
d.add("a string");
|
||||||
|
|
||||||
|
StringPersistentCollection s = new StringPersistentCollection();
|
||||||
|
s.add("a string");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
50
Examples/test-suite/template_typedef_inherit.i
Normal file
50
Examples/test-suite/template_typedef_inherit.i
Normal file
|
|
@ -0,0 +1,50 @@
|
||||||
|
%module template_typedef_virtual
|
||||||
|
|
||||||
|
// Bug 3378145
|
||||||
|
|
||||||
|
%include std_string.i
|
||||||
|
|
||||||
|
%inline %{
|
||||||
|
#include <string> // for std::string
|
||||||
|
|
||||||
|
typedef std::string String;
|
||||||
|
|
||||||
|
namespace Type {
|
||||||
|
template <class T> class TypedInterfaceObject {};
|
||||||
|
|
||||||
|
template <class T> class TypedCollectionInterfaceObject : public TypedInterfaceObject<T> {
|
||||||
|
public:
|
||||||
|
typedef T ImplementationType;
|
||||||
|
typedef typename ImplementationType::ElementType ImplementationElementType;
|
||||||
|
|
||||||
|
/** Method add() appends an element to the collection */
|
||||||
|
void add(const ImplementationElementType & elt) {}
|
||||||
|
};
|
||||||
|
|
||||||
|
template <class T> class PersistentCollection {
|
||||||
|
public:
|
||||||
|
typedef T ElementType;
|
||||||
|
|
||||||
|
/** Method add() appends an element to the collection */
|
||||||
|
inline virtual void add(const T & elt) {}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
%}
|
||||||
|
|
||||||
|
%template(StringPersistentCollection) Type::PersistentCollection<String>;
|
||||||
|
|
||||||
|
%inline %{
|
||||||
|
|
||||||
|
namespace Type {
|
||||||
|
class DescriptionImplementation : public PersistentCollection<String> {
|
||||||
|
public:
|
||||||
|
typedef PersistentCollection<String>::ElementType ElementType;
|
||||||
|
DescriptionImplementation() {}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
%}
|
||||||
|
|
||||||
|
%template(DescriptionImplementationTypedInterfaceObject) Type::TypedInterfaceObject<Type::DescriptionImplementation>;
|
||||||
|
%template(DescriptionImplementationTypedCollectionInterfaceObject) Type::TypedCollectionInterfaceObject<Type::DescriptionImplementation>;
|
||||||
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue