<html>
    <head>
      <base href="https://bugs.llvm.org/">
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - Availability attribute incorrectly triggers when function is called in a default argument of an unavailable function"
   href="https://bugs.llvm.org/show_bug.cgi?id=40991">40991</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Availability attribute incorrectly triggers when function is called in a default argument of an unavailable function
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>clang
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>trunk
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>PC
          </td>
        </tr>

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

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>enhancement
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>Frontend
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>unassignedclangbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>ldionne@apple.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org, neeilans@live.com, richard-llvm@metafoo.co.uk
          </td>
        </tr></table>
      <p>
        <div>
        <pre>When defining a function `f` as unavailable, uses of other unavailable
functions within the body of `f` are not flagged (because the top-level
function is unavailable). However, using an unavailable function as a default
argument triggers an error:

    $ cat <<EOF | clang++ -xc++ -
    __attribute__((unavailable)) int bar() { return 0; }
    __attribute__((unavailable)) void foo(int = bar()) { }
    int main() { }
    EOF

Output:

    <stdin>:2:45: error: call to unavailable function 'bar':
    __attribute__((unavailable)) void foo(int = bar()) { }
                                                ^~~
    <stdin>:1:34: note: candidate function has been explicitly made unavailable
    __attribute__((unavailable)) int bar() { return 0; }
                                     ^

I think the call to bar() should not be flagged since foo() is marked
unavailable.</pre>
        </div>
      </p>


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

      <ul>
          <li>You are on the CC list for the bug.</li>
      </ul>
    </body>
</html>