1Module ByRef5
2    Function Main() As Integer
3        Dim result As Boolean
4
5        testsub(1)
6        result = True
7
8        If result = False Then
9            System.Console.WriteLine("FAIL ByRef5")
10            System.Console.WriteLine("(detailed message)")
11            Return 1
12        End If
13    End Function
14    Sub testsub(Optional ByRef value As Integer = 1)
15        value = 2
16    End Sub
17End Module
18