Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

LBound/UBound not working on Array passed ByRef as Variant #157

Closed
cristianbuse opened this issue May 18, 2021 · 1 comment
Closed

LBound/UBound not working on Array passed ByRef as Variant #157

cristianbuse opened this issue May 18, 2021 · 1 comment
Labels
bug Something isn't working confirmed the issue has been verified

Comments

@cristianbuse
Copy link

cristianbuse commented May 18, 2021

Describe the bug
When passing an Array to another method ByRef As Variant then LBound/UBound do not work

To Reproduce

Module Test
    Public Sub Main()
        Dim arr() As Variant
        
        arr = Array(1, 2, 3)
        MsgBox GetArrayLBound(arr)
    End Sub
    
    Public Function GetArrayLBound(ByRef arr As Variant) As Long
        GetArrayLBound = LBound(arr)
    End Function
End Module

Expected behavior
If used on an Array passed ByRef (Variant), the LBound should return 0 but instead returns something looking as a pointer.

Screenshots
test

Desktop (please complete the following information):

  • OS: Windows 10 Enterprise V1909
  • twinBASIC compiler v0.9.2720

Additional context
It seems like the same issue occurs if calling the function with any value not just arrays. For exampleMsgBox GetArrayLBound(1) should raise a runtime error (13 - type mismatch in VBA) but instead tB aborts execution.

Moreover, the same issue occurs in this code:

Module Test
    Public Sub Main()
        Dim v As Variant
        v = 1
        MsgBox LBound(v)
    End Sub
End Module
@WaynePhillipsEA WaynePhillipsEA added bug Something isn't working confirmed the issue has been verified labels May 19, 2021
@WaynePhillipsEA
Copy link
Collaborator

Fixed in v0.10.313, thanks for reporting

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working confirmed the issue has been verified
Projects
None yet
Development

No branches or pull requests

2 participants