Add testcase for nested inner class deriving from a templated base class and defined outside of the outer class.
For languages that don't support nested class support, use flatnested. See issue #270
This commit is contained in:
parent
70a04c9ffe
commit
68a936a638
4 changed files with 79 additions and 0 deletions
38
Examples/test-suite/nested_template_base.i
Normal file
38
Examples/test-suite/nested_template_base.i
Normal file
|
|
@ -0,0 +1,38 @@
|
|||
%module nested_template_base
|
||||
|
||||
%inline %{
|
||||
template <class T> class OuterT {
|
||||
public:
|
||||
T outer(T t) { return t; }
|
||||
};
|
||||
%}
|
||||
|
||||
// The %template goes after OuterT and before OuterC as OuterC::InnerC's base is handled inside OuterC
|
||||
%template(OuterTInnerS) OuterT<OuterC::InnerS>;
|
||||
|
||||
#if !defined(SWIGCSHARP) && !defined(SWIGJAVA)
|
||||
%feature("flatnested") OuterC::InnerS;
|
||||
%feature("flatnested") OuterC::InnerC;
|
||||
#endif
|
||||
|
||||
|
||||
%inline %{
|
||||
class OuterC {
|
||||
public:
|
||||
class InnerS;
|
||||
class InnerC;
|
||||
};
|
||||
|
||||
struct OuterC::InnerS {
|
||||
int val;
|
||||
InnerS(int val = 0) : val(val) {}
|
||||
};
|
||||
|
||||
|
||||
class OuterC::InnerC : public OuterT<InnerS> {
|
||||
public:
|
||||
OuterT<InnerS>& innerc() {
|
||||
return *this;
|
||||
}
|
||||
};
|
||||
%}
|
||||
Loading…
Add table
Add a link
Reference in a new issue