Fix incorrectly shown warning for empty template instantiation used as a base class.
This commit is contained in:
parent
90f9117e10
commit
2165f27f5d
4 changed files with 47 additions and 4 deletions
|
|
@ -418,6 +418,7 @@ CPP_TEST_CASES += \
|
|||
template_default_inherit \
|
||||
template_default_qualify \
|
||||
template_default_vw \
|
||||
template_empty_inherit \
|
||||
template_enum \
|
||||
template_enum_ns_inherit \
|
||||
template_enum_typedef \
|
||||
|
|
|
|||
30
Examples/test-suite/template_empty_inherit.i
Normal file
30
Examples/test-suite/template_empty_inherit.i
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
%module template_empty_inherit
|
||||
|
||||
%inline %{
|
||||
template<class Arg, typename Result> struct Functor {
|
||||
virtual Result operator()(Arg x) const = 0;
|
||||
};
|
||||
%}
|
||||
|
||||
// Bug fix - %ignore was resulting in this warning:
|
||||
// Warning 401: Base class 'Functor< int,int >' has no name as it is an empty template instantiated with '%template()'. Ignored.
|
||||
%ignore Functor<int, int>;
|
||||
%template() Functor<int, int>;
|
||||
|
||||
%inline %{
|
||||
#include <algorithm>
|
||||
struct SquareFunctor : Functor<int, int> {
|
||||
int operator()(int v) const { return v*v; }
|
||||
};
|
||||
%}
|
||||
|
||||
%include <std_vector.i>
|
||||
%template(VectorInt) std::vector<int>;
|
||||
|
||||
%inline %{
|
||||
std::vector<int> squares(const std::vector<int>& vi) {
|
||||
std::vector<int> result;
|
||||
std::transform(vi.begin(), vi.end(), std::back_inserter(result), SquareFunctor());
|
||||
return result;
|
||||
}
|
||||
%}
|
||||
Loading…
Add table
Add a link
Reference in a new issue