OOP-passing of object references
Submitted by Elemer Lelik
Link to original bug (#568744)
Description
The below code terminates in C++ error:
/***************************************************************** ** @author STF 572 ** @version 0.0.1 ** @purpose 5.1.1.0, Ensure that passing of object references to the create operation of a component type or a function started on another component is not allowed. ** @verdict pass reject *****************************************************************/ module NegSem_50101_top_level_004 "TTCN-3:2018 Object-Oriented" {
type component GeneralComp {
}
type component MyNotEmptyComponent{
const charstring c_MyCstr := "def";
}
function doSomething(in MyEmptyClass e) runs on MyNotEmptyComponent {
log("Nothing in MyEmptyClass e");
}
public type class MyEmptyClass runs on GeneralComp {
}
testcase TC_NegSem_50101_top_level_004_02() runs on GeneralComp {
var MyEmptyClass v_MyClass := MyEmptyClass.create();
var MyNotEmptyComponent v_MyComponent := MyNotEmptyComponent.create alive;
v_MyComponent.start(doSomething(v_MyClass)); //not allowed
setverdict(pass);
}
control {
// execute(TC_NegSem_50101_top_level_004_01());
execute(TC_NegSem_50101_top_level_004_02());
}
}
g++ -c -DLINUX -I/home/james00/titan.core/Install/include -Wall -o NegSem_50101_top_level_004.o NegSem_50101_top_level_004.cc NegSem_50101_top_level_004.cc: In function ‘verdicttype NegSem__50101__top__level__004::testcase_TC__NegSem__50101__top__level__004__02(boolean, double)’: NegSem_50101_top_level_004.cc:78:1: error: ‘start_doSomething’ was not declared in this scope start_doSomething(v__MyComponent, v__MyClass); ^~~~~~~~~~~~~~~~~ NegSem_50101_top_level_004.cc:78:1: note: suggested alternative: ‘doSomething’ start_doSomething(v__MyComponent, v__MyClass); ^~~~~~~~~~~~~~~~~ doSomething Makefile:144: recipe for target 'NegSem_50101_top_level_004.o' failed make: *** [NegSem_50101_top_level_004.o] Error 1
Version: 7.1.0