Skip to content

Wrong code generated when accessing parent class member

When a class extends a parent that is defined in a separate module, the code generated for referencing an inherited member has an extra 'modulename::' prefix.

Example code:

module m1 {
    public type class @abstract Parent {	  	 	    
        var charstring cmd := "";
    }

    const integer mycon := 0;
}

module m2 {
    import from m1 all; 
    type class @final Child extends Parent {
        var integer v_cap;

        create():Parent("") {
            v_cap := 1;
            cmd := "abcd";
        }
    }
}

The generated code for cmd := "abcd" includes:

/* m2.ttcn3, line 8 */
m1::cmd = cs_0;

This results a gcc compile error:

image

If the parent and the child classes are in the same module, there is no compile error as the generated code is:

this->cmd = cs_0;