OOP: issues with parameter default values and inheritance
## Summary The code generated for the following TTCN-3 module produces several C++ compilation errors (details below). ## Steps and/or TTCN-3 code to reproduce ``` type component CT { } type class @trait CommonInterface { public function @abstract f_do_common(charstring p_test/* := "test"*/); } type class @abstract Base extends CommonInterface { public function f_do_common(charstring p_test:="test") { log("called from Base: "&p_test) } } type class @final Sub extends Base { public function f_do_common(charstring p_test:="test") { log("called from Sub: "&p_test); } } testcase tc() runs on CT { var Sub sub := Sub.create(); sub.f_do_common(); sub.f_do_common("test2"); } control { execute(tc()) } ``` ## What is the current bug behavior? There are 3 issues in the generated code: 1. The parameter default values generated for functions 'Base.f_do_common' and 'Sub.f_do_common' have the same name: 'f__do__common_p__test_defval'. 1. The type of the parameter in the 3 'f_do_common' functions are different (wrapper types are generated for parameters with default values in class methods, so they can contain references to class members). Because of this, the 3 'f_do_common' functions are interpreted as different functions by the C++ compiler, which results in 'Sub' being interpreted as an abstract class. 1. Class 'Base' inherits both 'CommonInterface' and the built-in class 'object'. Both of these inherit a separate version of 'CLASS_BASE' in C++. The compiler can't decide which of the reference counter functions ('add_ref' and 'remove_ref') inherited from 'CLASS_BASE' it should call. ## What is the expected correct behavior? The generated code should compile successfully. ## Relevant logs and/or screenshots - ## Possible fixes - ## Titan version 8.2.0 ## Platform details (OS type and version) Ubuntu 20.04.1 /cc @aknappqwt
issue

Copyright © Eclipse Foundation AISBL. All rights reserved.     Privacy Policy | Terms of Use | Copyright Agent