Fix 1832613 - template function pointer typedefs
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@10195 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
parent
afc303a8ec
commit
da509bd641
4 changed files with 80 additions and 18 deletions
|
|
@ -307,6 +307,7 @@ CPP_TEST_CASES += \
|
|||
template_typedef_cplx3 \
|
||||
template_typedef_cplx4 \
|
||||
template_typedef_cplx5 \
|
||||
template_typedef_funcptr \
|
||||
template_typedef_ns \
|
||||
template_typedef_ptr \
|
||||
template_typedef_rec \
|
||||
|
|
|
|||
48
Examples/test-suite/template_typedef_funcptr.i
Normal file
48
Examples/test-suite/template_typedef_funcptr.i
Normal file
|
|
@ -0,0 +1,48 @@
|
|||
%module template_typedef_funcptr
|
||||
|
||||
//Bug #1832613
|
||||
|
||||
%include <std_string.i>
|
||||
|
||||
%inline %{
|
||||
|
||||
#include <string>
|
||||
|
||||
template<typename T> class Ptr {};
|
||||
|
||||
class MCContract {};
|
||||
typedef Ptr<MCContract> MCContractPtr;
|
||||
%}
|
||||
|
||||
%template() Ptr<MCContract>;
|
||||
|
||||
%inline %{
|
||||
template <class Contract, typename ContractID, typename CallbackType>
|
||||
class ContractFactory
|
||||
{
|
||||
public:
|
||||
static ContractFactory<Contract,ContractID,CallbackType> &getInstance() {
|
||||
static ContractFactory<Contract, ContractID, CallbackType> instance;
|
||||
return instance;
|
||||
}
|
||||
};
|
||||
/**
|
||||
* CreateXXContractCallback is a pointer to a function taking no arguments and
|
||||
* returning a pointer to an XXContract.
|
||||
*/
|
||||
typedef MCContractPtr (*CreateMCContractCallback)();
|
||||
%}
|
||||
|
||||
|
||||
//Get around it by changing this:
|
||||
%template(MCContractFactory) ContractFactory<MCContract, std::string, CreateMCContractCallback>;
|
||||
|
||||
//to a form which expands the typedef:
|
||||
//%template(MCContractFactory) ContractFactory<MCContract, std::string, Ptr<MCContract>(*)()>;
|
||||
|
||||
%inline %{
|
||||
typedef MCContractPtr* ContractPtrPtr;
|
||||
%}
|
||||
// Plain pointers were also causing problems...
|
||||
%template(MCContractFactory2) ContractFactory<MCContract, std::string, ContractPtrPtr>;
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue