more ugly tests
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@6367 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
parent
536e2e545c
commit
e0dbc02e10
2 changed files with 40 additions and 12 deletions
|
|
@ -0,0 +1,5 @@
|
||||||
|
import template_default_arg
|
||||||
|
|
||||||
|
fz = template_default_arg.Foo_Z_8()
|
||||||
|
x = template_default_arg.X_Foo_Z_8()
|
||||||
|
fzc = x.meth(fz)
|
||||||
|
|
@ -1,9 +1,17 @@
|
||||||
%module template_default_arg
|
%module template_default_arg
|
||||||
|
|
||||||
%warnfilter(801) hi; /* Ruby, wrong class name */
|
|
||||||
%warnfilter(801) Hello; /* Ruby, wrong class name */
|
%warnfilter(801) Hello; /* Ruby, wrong class name */
|
||||||
|
|
||||||
%inline %{
|
%inline %{
|
||||||
|
template <class T>
|
||||||
|
struct Foo
|
||||||
|
{
|
||||||
|
typedef unsigned int size_type;
|
||||||
|
Foo(size_type n = size_type(0) ) { }
|
||||||
|
};
|
||||||
|
|
||||||
|
int foob(Foo<int> h = Foo<int>()) {return 1; }
|
||||||
|
|
||||||
template <class T>
|
template <class T>
|
||||||
struct Hello
|
struct Hello
|
||||||
{
|
{
|
||||||
|
|
@ -21,18 +29,29 @@
|
||||||
};
|
};
|
||||||
|
|
||||||
template <typename T> struct X {
|
template <typename T> struct X {
|
||||||
X(T t = T()) {}
|
X(const T& t = T()) {}
|
||||||
X(double a, T t = T(0)) {}
|
X(double a, const T& t = T(0)) {}
|
||||||
T meth(double a, T t = T(0)) { return t; }
|
T meth(double a, const T& t = T(0)) { return t; }
|
||||||
T meth(T t = T(0)) { return t; }
|
const T& meth(const T& t = T(0)) { return t; }
|
||||||
};
|
|
||||||
template <typename T> class Y : private X<T> {
|
|
||||||
public:
|
|
||||||
// test using on templated class with default args in the method
|
|
||||||
using X<T>::meth;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
template <typename T> class Y : private X<T> {
|
||||||
|
public:
|
||||||
|
// test using on templated class with default args in the method
|
||||||
|
using X<T>::meth;
|
||||||
|
};
|
||||||
|
|
||||||
|
template <int V> struct Z
|
||||||
|
{
|
||||||
|
Z(int t = V) {}
|
||||||
|
// and also:
|
||||||
|
Z(double a, int t = V){}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
%}
|
%}
|
||||||
|
|
||||||
|
%template(Foo_int) Foo<int>;
|
||||||
%template(Hello_int) Hello<int>;
|
%template(Hello_int) Hello<int>;
|
||||||
%template(X_int) X<int>;
|
%template(X_int) X<int>;
|
||||||
%template(X_longlong) X<long long>;
|
%template(X_longlong) X<long long>;
|
||||||
|
|
@ -41,12 +60,16 @@
|
||||||
|
|
||||||
%template(X_hello_unsigned) X<Hello<int> >;
|
%template(X_hello_unsigned) X<Hello<int> >;
|
||||||
%template(Y_hello_unsigned) Y<Hello<int> >;
|
%template(Y_hello_unsigned) Y<Hello<int> >;
|
||||||
|
%template(X_Foo_Foo_int) X<Foo<Foo<int> > >;
|
||||||
|
%template(Z_8) Z<8>;
|
||||||
|
%template(Foo_Z_8) Foo<Z<8> >;
|
||||||
|
%template(X_Foo_Z_8) X<Foo<Z<8> > >;
|
||||||
|
|
||||||
%inline %{
|
%inline %{
|
||||||
|
|
||||||
struct hi : Hello<int>
|
struct Bar : Hello<int>
|
||||||
{
|
{
|
||||||
hi(size_type n) : Hello<int>(n)
|
Bar(size_type n) : Hello<int>(n)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue