bcc icon indicating copy to clipboard operation
bcc copied to clipboard

Duplicate method definition not thrown when calling it in itself

Open GWRon opened this issue 4 years ago • 0 comments

I accidentally overloaded a method with the same method definition (the the one missing some params should call the other with defaults). When removing the M(i) bcc fails with a proper error message ... but with this call it continues compilation until it fails then in C.

SuperStrict

Framework Brl.Color

Type TTest
	Method M:Int(i:Int)
		M(i)
	End Method
	
	Method M:Int(i:Int)
	End Method
End Type

received error:

Building untitled1
[ 93%] Compiling:untitled1.bmx.console.debug.linux.x64.c
/BlitzMaxNG/tmp/.bmx/untitled1.bmx.console.debug.linux.x64.c:36:7: error: redefinition of ‘__m_untitled1_TTest_M_i’
 BBINT __m_untitled1_TTest_M_i(struct _m_untitled1_TTest_obj* o,BBINT bbt_i){
       ^~~~~~~~~~~~~~~~~~~~~~~
/BlitzMaxNG/tmp/.bmx/untitled1.bmx.console.debug.linux.x64.c:7:7: note: previous definition of ‘__m_untitled1_TTest_M_i’ was here
 BBINT __m_untitled1_TTest_M_i(struct _m_untitled1_TTest_obj* o,BBINT bbt_i){
       ^~~~~~~~~~~~~~~~~~~~~~~
Build Error: failed to compile (256) /BlitzMaxNG/tmp/.bmx/untitled1.bmx.console.debug.linux.x64.c
Process complete

expected error:

Compile Error: Duplicate declaration Method TTest.M:Int(i:Int)

GWRon avatar Aug 17 '20 09:08 GWRon