<html>
    <head>
      <base href="https://bugs.documentfoundation.org/">
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_UNCONFIRMED "
   title="UNCONFIRMED - Regression Err:448 in Optional arguments"
   href="https://bugs.documentfoundation.org/show_bug.cgi?id=136143">136143</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Regression Err:448 in Optional arguments
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>LibreOffice
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>7.0.0.3 release
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>All
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>All
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>UNCONFIRMED
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>normal
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>medium
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>BASIC
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>libreoffice-bugs@lists.freedesktop.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>jp@ledure.be
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Created <span class=""><a href="http://bugs.documentfoundation.org/attachment.cgi?id=164709" name="attach_164709" title="Error448.odt with Basic code">attachment 164709</a> <a href="http://bugs.documentfoundation.org/attachment.cgi?id=164709&action=edit" title="Error448.odt with Basic code">[details]</a></span>
Error448.odt with Basic code

When running Main() in next Basic code, containing a cascade of calls with
uninitialized optional arguments, the behaviour is different between LO 6.4.5
and LO 7.0.0

Sub Main
Dim a
        a = 1
        SubA(a)
End Sub

Sub SubA(a, Optional x, Optional y)
        SubB(a, x, y)
End Sub

Sub SubB(a, Optional x, Optional y)
        If IsMissing(x) Then x = 2
        MsgBox x
End Sub

In 6.4, the execution ends with the message box containing "2", as expected.

In 7.0 however, the execution aborts on the statement "x = 2" with the error
message
"Inadmissible value or data type. Data type mismatch."

The reason, AFAIK, seems to be that variable x in SubB is of type
- Variant/Error in LO6.4
- Error in LO 7.0
the latter preventing a reset of x to another value.

To reproduce the issue:
----------------------
- open the attached Error448.odt file
- open the Basic IDE
- in the Basic module of the file "Module1", run Main()

Result in 7.0:
-------------
Error "Inadmissible value or data type. Data type mismatch."

Expected result:
---------------
No error message


PS: current bug is the root cause of
<a class="bz_bug_link 
          bz_status_ASSIGNED "
   title="ASSIGNED - access2base recordset-bug"
   href="show_bug.cgi?id=136063">https://bugs.documentfoundation.org/show_bug.cgi?id=136063</a></pre>
        </div>
      </p>


      <hr>
      <span>You are receiving this mail because:</span>

      <ul>
          <li>You are the assignee for the bug.</li>
      </ul>
    </body>
</html>