https://bugs.freedesktop.org/show_bug.cgi?id=36737

--- Comment #4 from Bob <bobbux...@gmail.com> ---
I was about to open a very similar bug report and can provide a simple test
case to demonstrate the problem still occurs of LO 4.3.0.3

VBA allows an optional parameter to be defined as - optional str as string =
"abc" - the variable is not initialized to "abc" in LO

Alternatively if no default is provided - optional mstr as string mstr  -
should not be initialized and isMissing(mstr) should return True it actually
returns false and mstr is a null string

LO works correctly for data type Double and Variant,  I have not tested other
data types

This error is particularly insidious when porting from Excel since no error is
raised and differences in function execution may not be readily apparent.

I used the following function to show the problem:

function TestOpt(optional num as double =123,  optional str as string = "abc",
optional numv  =456,  optional strv = "def", optional miss as double, optional
mstr as string) as string 
Dim printstr as string 

printstr =              "num: >>" &num &"<<  isMissing " & isMissing(num) 
printstr = printstr & "; str: >>" &str &"<<  isMissing " & isMissing(str) 

printstr = printstr & "; numv: >>" &numv &"<<  isMissing " & isMissing(numv) 
printstr = printstr & "; strv: >>" &strv &"<<  isMissing " & isMissing(strv)
rem print printstr
printstr = printstr & "; miss: >>" &miss &"<<  isMissing " & isMissing(miss)
printstr = printstr & "; mstr: >>" &mstr &"<<  isMissing " & isMissing(mstr)
print printstr
TestOpt = printstr
end function 

Output is 
num: >>123<<  isMissing False; str: >><<  isMissing False; numv: >>456<< 
isMissing False; strv: >>def<<  isMissing False; miss: >>Error ǀ<<  isMissing
True; mstr: >><<  isMissing False

str and mstr are handled incorrectly, Double and Variant formats are correct

-- 
You are receiving this mail because:
You are the assignee for the bug.
_______________________________________________
Libreoffice-bugs mailing list
Libreoffice-bugs@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-bugs

Reply via email to