diff --git a/changelog.txt b/changelog.txt index 79e7f1767c..85886bfe56 100644 --- a/changelog.txt +++ b/changelog.txt @@ -24,6 +24,7 @@ Version 1.20.0 - gas64: handle priority for constructors/destructors (SARG) - gas64: optimization 16 modified retrieval of registers and improved to handle specific cases (SARG) - gas64: NEW UBYTE/BYTE[count] not handled (SARG) +- sf.net #988: (regression) re-allow overloaded non-indexed array arguments - Can't pass UDT member array to an overloaded sub Version 1.10.1 diff --git a/src/compiler/parser-proccall-args.bas b/src/compiler/parser-proccall-args.bas index 44c34b9ea3..ef82ecb970 100644 --- a/src/compiler/parser-proccall-args.bas +++ b/src/compiler/parser-proccall-args.bas @@ -105,6 +105,14 @@ private function hProcArg _ lexSkipToken( ) amode = FB_PARAMMODE_BYDESC end if + else + '' already a non-indexed array? + if( astIsNIDXARRAY( expr ) ) then + if( amode <> INVALID ) then + errReport( FB_ERRMSG_PARAMTYPEMISMATCH ) + end if + amode = FB_PARAMMODE_BYDESC + end if end if end if end if @@ -192,6 +200,14 @@ private sub hOvlProcArg _ lexSkipToken( ) arg->mode = FB_PARAMMODE_BYDESC end if + else + '' already a non-indexed array? + if( astIsNIDXARRAY( arg->expr ) ) then + if( arg->mode <> INVALID ) then + errReport( FB_ERRMSG_PARAMTYPEMISMATCH ) + end if + arg->mode = FB_PARAMMODE_BYDESC + end if end if end if end sub diff --git a/tests/overload/bydesc.bas b/tests/overload/bydesc.bas index 4d87c9b97e..f93be2fe4b 100644 --- a/tests/overload/bydesc.bas +++ b/tests/overload/bydesc.bas @@ -62,6 +62,28 @@ SUITE( fbc_tests.overload_.bydesc ) CU_ASSERT( proc( scalar_single ) = RESULT_SCALAR_SINGLE ) CU_ASSERT( proc( scalar_intptr ) = RESULT_SCALAR_INTPTR ) END_TEST + + type udt_with_arrays + dim as integer array_int(any), scalar_int + dim as uinteger array_uint(any), scalar_uint + dim as single array_single(any), scalar_single + dim as integer ptr array_intptr(any), scalar_intptr + end type + + + TEST( udt ) + dim x as udt_with_arrays + + CU_ASSERT( proc( x.array_int() ) = RESULT_ARRAY_INT ) + CU_ASSERT( proc( x.array_uint() ) = RESULT_ARRAY_UINT ) + CU_ASSERT( proc( x.array_single() ) = RESULT_ARRAY_SINGLE ) + CU_ASSERT( proc( x.array_intptr() ) = RESULT_ARRAY_INTPTR ) + + CU_ASSERT( proc( x.scalar_int ) = RESULT_SCALAR_INT ) + CU_ASSERT( proc( x.scalar_uint ) = RESULT_SCALAR_UINT ) + CU_ASSERT( proc( x.scalar_single ) = RESULT_SCALAR_SINGLE ) + CU_ASSERT( proc( x.scalar_intptr ) = RESULT_SCALAR_INTPTR ) + END_TEST END_TEST_GROUP TEST_GROUP( dimensions1vs2 )