Avoid errors due to generating identical overloads

Add typecheck typemaps for primitive types and string and call
Swig_overload_check() to ensure that we don't generate two wrappers
functions taking the same "const char*" type if we have overloads taking
it and "std::string" (or a reference) in the original code.
This commit is contained in:
Vadim Zeitlin 2021-12-05 20:49:20 +01:00
commit a335fff2ec
3 changed files with 96 additions and 0 deletions

View file

@ -402,6 +402,14 @@ public:
if (Checkattr(n, "storage", "friend"))
return;
// Usually generating wrappers for overloaded methods is fine, but sometimes their types can clash after applying typemaps and in this case we have no
// choice but to avoid generating them, as otherwise we'd just generate uncompilable code.
if (Getattr(n, "sym:overloaded")) {
Swig_overload_check(n);
if (Getattr(n, "overload:ignore"))
return;
}
temp_ptr_setter<Node*> set(&node_func_, n);
// As mentioned elsewhere, we can't use Swig_storage_isstatic() here because the "storage" attribute is temporarily saved in another view when this