https://bugs.documentfoundation.org/show_bug.cgi?id=145570
--- Comment #8 from Mike Kaganski <[email protected]> --- I am unsure how to proceed with this. I consider two options: first one, specific to this bug report, would be to drop dimension information in compiler after a ReDim - that means something like --- a/basic/source/comp/dim.cxx +++ b/basic/source/comp/dim.cxx @@ -536,6 +536,7 @@ void SbiParser::DefVar( SbiOpcode eOp, bool bStatic ) aExpr.Gen(); aGen.Gen( SbiOpcode::REDIMP_ERASE_ ); } + short oldDims = pDef->GetDims(); pDef->SetDims( pDim->GetDims() ); if( bPersistentGlobal ) pDef->SetGlobal( true ); @@ -543,6 +544,11 @@ void SbiParser::DefVar( SbiOpcode eOp, bool bStatic ) aExpr.Gen(); pDef->SetGlobal( false ); aGen.Gen( (eOp == SbiOpcode::STATIC_) ? SbiOpcode::DIM_ : eOp ); + if (eOp == SbiOpcode::REDIM_) + { + if (pDef->GetDims() != oldDims) + pDef->SetDims(0); // do not check dimensions for this variable at all + } } } if( !TestComma() ) but that still isn't perfect. Additionally, I don't know if missing dims would hit elsewhere. I lean towards the other option, which is removing the error itself: --- a/basic/source/comp/exprtree.cxx +++ b/basic/source/comp/exprtree.cxx @@ -295,14 +295,6 @@ std::unique_ptr<SbiExprNode> SbiExpression::Term( const KeywordSymbolInfo* pKeyw } } - // 0 parameters come up to () - if( pDef->GetDims() ) - { - if( pPar && pPar->GetSize() && pPar->GetSize() != pDef->GetDims() ) - { - pParser->Error( ERRCODE_BASIC_WRONG_DIMS ); - } - } if( pDef->IsDefinedAs() ) { SbxDataType eDefType = pDef->GetType(); It may be better also in cases where a usual Dim appeared, but then the array was sent to a function taking ByRef argument, and which could ReDim it. We provide too much of flexibility in our flavor of Basic, so it's silly to limit then what the user can do with that flexibility. -- You are receiving this mail because: You are the assignee for the bug.
