bcc icon indicating copy to clipboard operation
bcc copied to clipboard

Interfaces - incorrect C Code when parameters in implementation differ

Open GWRon opened this issue 3 months ago • 0 comments

The following code generates invalid C Code:

SuperStrict

Framework Brl.StandardIO


Interface ISerialize
    Method Serialize:Object(context:TSerializationContext)
    Method Deserialize(context:TSerializationContext, data:Object)
End Interface


Type TSerializationContext
End Type



Type TBase Implements ISerialize
	Field i1:Int
	
	
	Method Serialize:Object(context:Object)
	End Method

	Method Deserialize(context:Object, data:Object)
	End Method
End Type

Error:

/Testcodes/.bmx/serializer.bmx.gui.release.linux.x64.h:70:23: error: ‘static_cast’ undeclared here (not in a function)
   70 | BBOBJECT bbt_context2=static_cast<BBOBJECT >(bbt_context);
      |                       ^~~~~~~~~~~
/Testcodes/.bmx/serializer.bmx.gui.release.linux.x64.h:70:35: error: expected expression before ‘BBOBJECT’
   70 | BBOBJECT bbt_context2=static_cast<BBOBJECT >(bbt_context);
      |                                   ^~~~~~~~
/Testcodes/.bmx/serializer.bmx.gui.release.linux.x64.h:73:10: error: redefinition of ‘bbt_context2’
   73 | BBOBJECT bbt_context2=static_cast<BBOBJECT >(bbt_context);
      |          ^~~~~~~~~~~~
/Testcodes/.bmx/serializer.bmx.gui.release.linux.x64.h:70:10: note: previous definition of ‘bbt_context2’ with type ‘BBOBJECT’ {aka ‘BBObject *’}
   70 | BBOBJECT bbt_context2=static_cast<BBOBJECT >(bbt_context);
      |          ^~~~~~~~~~~~
...
Compilation failed.
``

If you correct the parameter-Types (`context:Object`->`context:TSerializationContext`) then it compiles correctly.

GWRon avatar Sep 08 '25 15:09 GWRon