Skip to content

Commit 51257cb

Browse files
fix according InterOp's overload resolution changes (#131)
from compiler-research/CppInterOp#514
1 parent f3399ac commit 51257cb

File tree

1 file changed

+12
-5
lines changed

1 file changed

+12
-5
lines changed

clingwrapper/src/clingwrapper.cxx

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -233,6 +233,8 @@ class ApplicationStarter {
233233

234234
// load frequently used headers
235235
const char* code =
236+
"#include <algorithm>\n"
237+
"#include <complex>\n"
236238
"#include <iostream>\n"
237239
"#include <string.h>\n" // for strcpy
238240
"#include <string>\n"
@@ -1511,11 +1513,16 @@ Cppyy::TCppMethod_t Cppyy::GetMethodTemplate(
15111513
Cppyy::AppendTypesSlow(proto, arg_types);
15121514
Cppyy::AppendTypesSlow(explicit_params, templ_params);
15131515

1514-
Cppyy::TCppMethod_t cppmeth = Cpp::BestTemplateFunctionMatch(unresolved_candidate_methods, templ_params, arg_types);
1515-
1516-
if(!cppmeth){
1517-
return nullptr;
1518-
}
1516+
Cppyy::TCppMethod_t cppmeth = nullptr;
1517+
1518+
if (unresolved_candidate_methods.size() == 1 && !templ_params.empty())
1519+
cppmeth =
1520+
Cpp::InstantiateTemplate(unresolved_candidate_methods[0],
1521+
templ_params.data(), templ_params.size());
1522+
1523+
if (!cppmeth)
1524+
cppmeth = Cpp::BestOverloadFunctionMatch(unresolved_candidate_methods,
1525+
templ_params, arg_types);
15191526

15201527
return cppmeth;
15211528

0 commit comments

Comments
 (0)