Using declarations in inheritance hierarchy improvements.
- Improved documentation for using declarations. - Issue new warning WARN_LANG_USING_NAME_DIFFERENT when there is a conflict in the target language name to be used when introducing a method via a using declaration. Previously the method was silently ignored. Issue #1840. Issue #655.
This commit is contained in:
parent
e36e898c0a
commit
79a1bbee8b
8 changed files with 176 additions and 30 deletions
7
Examples/test-suite/errors/cpp_using_rename.stderr
Normal file
7
Examples/test-suite/errors/cpp_using_rename.stderr
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
cpp_using_rename.i:18: Warning 526: Using declaration Base::use_me, with name 'use_me', is not actually using
|
||||
cpp_using_rename.i:10: Warning 526: the method from Base::use_me(int), with name 'UseMe', as the names are different.
|
||||
cpp_using_rename.i:19: Warning 526: Using declaration Base::use_me_too, with name 'UseMeToo', is not actually using
|
||||
cpp_using_rename.i:11: Warning 526: the method from Base::use_me_too(double) const, with name 'use_me_too', as the names are different.
|
||||
cpp_using_rename.i:19: Warning 526: Using declaration Base::use_me_too, with name 'UseMeToo', is not actually using
|
||||
cpp_using_rename.i:12: Warning 526: the method from Base::use_me_too(bool) const, with name 'use_me_too', as the names are different.
|
||||
cpp_using_rename.i:20: Warning 315: Nothing known about 'Base::does_not_exist'.
|
||||
|
|
@ -12,3 +12,13 @@ bb = BB()
|
|||
swig_assert_equal(bb.greater(int(1)), 0)
|
||||
swig_assert_equal(bb.greater(float(1)), 1)
|
||||
swig_assert_equal(bb.great(True), 2)
|
||||
|
||||
cc = CC()
|
||||
swig_assert_equal(cc.greater(int(10)), 0)
|
||||
swig_assert_equal(cc.greater(float(10)), 1)
|
||||
swig_assert_equal(cc.greater(True), 20)
|
||||
|
||||
dd = DD()
|
||||
swig_assert_equal(dd.greater(int(10)), 0)
|
||||
swig_assert_equal(dd.greater(float(10)), 1)
|
||||
swig_assert_equal(dd.greaterstill(True), 30)
|
||||
|
|
|
|||
|
|
@ -1,7 +1,13 @@
|
|||
%module using_member
|
||||
|
||||
/* using declaration tests, including renaming */
|
||||
%warnfilter(SWIGWARN_LANG_USING_NAME_DIFFERENT) one::twotwo::threetwo::BB::great;
|
||||
|
||||
%rename(greater) one::two::three::interface1::AA::great(int);
|
||||
%rename(greater) one::two::three::interface1::AA::great(float);
|
||||
%rename(greater) one::CC::great;
|
||||
%rename(greater) one::DD::great;
|
||||
%rename(greaterstill) one::DD::great(bool);
|
||||
|
||||
%inline %{
|
||||
namespace interface1
|
||||
|
|
@ -46,5 +52,19 @@ namespace one {
|
|||
};
|
||||
}
|
||||
}
|
||||
|
||||
class CC : public two::three::AA
|
||||
{
|
||||
public:
|
||||
using two::three::AA::great;
|
||||
int great(bool) {return 20;}
|
||||
};
|
||||
|
||||
class DD : public two::three::AA
|
||||
{
|
||||
public:
|
||||
using two::three::AA::great;
|
||||
int great(bool) {return 30;}
|
||||
};
|
||||
}
|
||||
%}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue