[Libreoffice-bugs] [Bug 125627] New: Typed reference parameter is treated as value parameter if ANY type conversion is needed.
bugzilla-daemon at bugs.documentfoundation.org
bugzilla-daemon at bugs.documentfoundation.org
Sat Jun 1 20:38:39 UTC 2019
https://bugs.documentfoundation.org/show_bug.cgi?id=125627
Bug ID: 125627
Summary: Typed reference parameter is treated as value
parameter if ANY type conversion is needed.
Product: LibreOffice
Version: 3.3.0 release
Hardware: All
OS: All
Status: UNCONFIRMED
Severity: normal
Priority: medium
Component: BASIC
Assignee: libreoffice-bugs at lists.freedesktop.org
Reporter: jag at psilosoph.de
This was reported years ago for OOo/AOO under a different accent.
See https://bz.apache.org/ooo/show_bug.cgi?id=120069
It may just be another bug demonstrating that a consistent implementation of
automatic type conversion is next to impossible.
Examples:
Sub TestVariant()
x = 77 REM Creates x as a Variant of current type Integer
in_outI(x)
REM Implicitly "converts" Variant/Integer to Integer creating a new variable.
Print x
REM should print 13, prints 77
in_outV(x) REM No implicit conversion
Print x
REM should print 13, prints 13
End Sub
Sub TestByte()
Dim x As Byte
x = 77
in_outI(x)
REM Implicitly converts Byte to Integer creating a new variable.
REM Should throw a type mismatch.
REM Otherwise automatic conversion of the result on return needed.
REM VERY problematic.
Print x
REM should print 13, prints 77
in_outV(x)
REM Implicitly converts Byte to Integer creating a new variable.
Print x
REM should print 13, prints 13
End Sub
Sub TestInteger()
Dim x As Integer
x = 77
in_outI(x) REM No implicit conversion.
Print x
REM should print 13, prints 13
End Sub
Sub in_outI(x As Integer)
x = 13
End Sub
Sub in_outV(x)
x=13
End Sub
Sub TestVS()
x = "test"
in_outS(x)
REM Implicitly "converts" Variant/String to String creating a new variable.
Print x
in_outSV(x)
REM No conversion.
Print x
End Sub
Sub in_outS(x As String)
x = "in_out"
End Sub
Sub in_outSV(x As Variant)
x = "in_out"
End Sub
What should be expected and what actually happens is placed in the example as
comments.
--
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/libreoffice-bugs/attachments/20190601/06600d9b/attachment.html>
More information about the Libreoffice-bugs
mailing list