Delegating constructors and inheriting constructors clarification and split of tests

git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/branches/gsoc2009-matevz@13852 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
William S Fulton 2012-09-25 20:22:15 +00:00
commit 4db087d81f
5 changed files with 63 additions and 34 deletions

View file

@ -434,6 +434,7 @@ CPP0X_TEST_CASES = \
cpp0x_constexpr \
cpp0x_decltype \
cpp0x_default_delete \
cpp0x_delegating_constructors \
cpp0x_explicit_conversion_operators \
cpp0x_function_objects \
cpp0x_initializer_list \
@ -453,7 +454,7 @@ CPP0X_TEST_CASES = \
cpp0x_userdefined_literals \
cpp0x_variadic_templates
# cpp0x_constructors \ # not supported by any compiler yet
# cpp0x_inheriting_constructors \ # not supported by gcc-4.7
# cpp0x_hash_tables \ # not fully implemented yet
# cpp0x_lambda_functions \ # not supported by GCC or MSVC yet
# cpp0x_thread_local \ # not supported by any compiler yet

View file

@ -1,30 +0,0 @@
/* This test checks whether SWIG correctly parses the new delegating
constructors and constructor inheritance.
*/
%module cpp0x_constructors
%inline %{
class BaseClass {
private:
int _val;
public:
BaseClass(int iValue) { _val = iValue; }
};
class DerivedClass: public BaseClass {
public:
using BaseClass::BaseClass; // Adds DerivedClass(int) constructor
};
class A {
public:
int a;
int b;
int c;
A() : A( 10 ) {}
A(int aa) : A(aa, 20) {}
A(int aa, int bb) : A(aa, bb, 30) {}
A(int aa, int bb, int cc) { a=aa; b=bb; c=cc; }
};
%}

View file

@ -0,0 +1,18 @@
/* This test checks whether SWIG correctly parses the new delegating
constructors.
*/
%module cpp0x_delegating_constructors
%inline %{
class A {
public:
int a;
int b;
int c;
A() : A( 10 ) {}
A(int aa) : A(aa, 20) {}
A(int aa, int bb) : A(aa, bb, 30) {}
A(int aa, int bb, int cc) { a=aa; b=bb; c=cc; }
};
%}

View file

@ -0,0 +1,18 @@
/* This test checks whether SWIG correctly parses the new constructor
inheritance.
*/
%module cpp0x_inheriting_constructors
%inline %{
class BaseClass {
private:
int _val;
public:
BaseClass(int iValue) { _val = iValue; }
};
class DerivedClass: public BaseClass {
public:
using BaseClass::BaseClass; // Adds DerivedClass(int) constructor
};
%}