Conflict of same function names in different modules
Summary
When different modules contains functions with the same name and function argument is defined in one of these modules, than C++ compilation is failed.
Steps and/or TTCN-3 code to reproduce
module v1 {
// definition of argument type to enable ADL in f()
type record T {
integer i
}
type component CT1 {
}
function f(T p) runs on CT1 {
}
}
module v2 {
import from v1 all;
function f(T p_v) runs on CT1 {
}
testcase TC1() runs on CT1 {
f({2}); // <-- Here is the problem.
}
}
Module v2
calls f()
with type of argument defined in v1
.
Even if function is called with module name, the final C++ code doesn't contain namespace.
What is the current bug behavior?
C++ compilation raise an error:
error: call of overloaded f(v1::T&)
is ambiguous
What is the expected correct behavior?
Should be compiled well.
Relevant logs and/or screenshots
build/WIN32/v2.cc: In function 'verdicttype v2::testcase_TC1(boolean, double)':
build/WIN32/v2.cc:66:2: error: call of overloaded 'f(v1::T&)' is ambiguous
66 | f(tmp_0);
| ~^~~~~~~
build/WIN32/v2.cc:35:6: note: candidate: 'void v2::f(const v1::T&)'
35 | void f(const v1::T& )
| ^
In file included from build/WIN32/v2.hh:20,
from build/WIN32/v2.cc:11:
build/WIN32/v1.hh:121:13: note: candidate: 'void v1::f(const T&)'
121 | extern void f(const T& );
| ^
Possible fixes
The problem arrives because of argument-dependent lookup(ADL). To avoid the problem, C++ function call should include the desired namespace: v2::f(const v1:T&)
Titan version
11
Platform details (OS type and version)
WIN and LINUX
/cc @aknappqwt @mmagyari