bcc icon indicating copy to clipboard operation
bcc copied to clipboard

Downcasting of externed types causes error

Open JoshKlint opened this issue 8 years ago • 2 comments

It looks like the compiler can't downcast an externed type that is derived from another type. This is definitely a feature my project makes heavy use of.

Example program:

SuperStrict
Extern "c"
	Type MyType
	EndType
	Type MyTypeExt Extends MyType
	EndType
EndExtern
Function TestFunc(objext:MyTypeExt)
	Local obj:MyType = objext
EndFunction

Output:

Building untitled1 [ 97%] Processing:untitled1.bmx [ 98%] Compiling:untitled1.bmx.gui.release.win32.x86.c C:/BMXNG/tmp/.bmx/untitled1.bmx.gui.release.win32.x86.c: In function '_m_untitled1_TestFunc': C:/BMXNG/tmp/.bmx/untitled1.bmx.gui.release.win32.x86.c:3:25: error: expected expression before ';' token struct MyType* bbt_obj=; ^ Build Error: failed to compile C:/BMXNG/tmp/.bmx/untitled1.bmx.gui.release.win32.x86.c Process complete

JoshKlint avatar Nov 04 '16 01:11 JoshKlint