Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Given an overloaded c++ function with std::vector arguments, SWIG warns incorrectly. #652

Open
tamuratak opened this issue Apr 11, 2016 · 1 comment
Labels

Comments

@tamuratak
Copy link
Contributor

Hi,
when creating a wrapper for an overloaded c++ function with std::vector arguments, swig warns incorrectly.
For example,

%module sample
%include std_vector.i
class A{};
class B{};
%template(StdVectorA) std::vector<A>;
%template(StdVectorB) std::vector<B>;
void f(const std::vector<A>&);
void f(const std::vector<B>&);

then

$ ../swig -version

SWIG Version 3.0.9

Compiled with g++ [x86_64-apple-darwin13.4.0]

Configured options: +pcre

Please see http://www.swig.org for reporting bugs and further information

$swig -c++ sample.i
sample.i:11: Warning 509: Overloaded method f(std::vector< B > const &) effectively ignored,
sample.i:10: Warning 509: as it is shadowed by f(std::vector< A > const &).

Actually, f(std::vector< B > const &) is NOT shadowed by f(std::vector< A > const &) and the generated code by swig itself seems correct.

Source/Modules/overload.cxx seems not to consider the case the arguments of overloaded functions are the standard containers library of C++.

Regards.

@lballabio
Copy link

Still present in 4.0.1, just bumped into it. SWIG doesn't actually ignore the overload as written in the warning; both overloads are generated. It prevents using -Werror, though.

@ojwb ojwb added the C++ label Jan 20, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants