<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 - apiModeling.llvm.CastValue checker crashes on every isa_and_nonnull<>()"
   href="https://bugs.llvm.org/show_bug.cgi?id=47037">47037</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>apiModeling.llvm.CastValue checker crashes on every isa_and_nonnull<>()
          </td>
        </tr>

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

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

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

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

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

        <tr>
          <th>Severity</th>
          <td>release blocker
          </td>
        </tr>

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

        <tr>
          <th>Component</th>
          <td>Static Analyzer
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>dcoughlin@apple.com
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>adam.balogh@ericsson.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>dcoughlin@apple.com, llvm-bugs@lists.llvm.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>isa_and_nonnull<>() is a variadic template:

template <typename... X, class Y>
LLVM_NODISCARD inline bool isa_and_nonnull(const Y &Val) {
  if (!Val)
    return false;
  return isa<X...>(Val);
}

This calls the variadic version of isa<>():

template <typename First, typename Second, typename... Rest, typename Y>
LLVM_NODISCARD inline bool isa(const Y &Val) {
  return isa<First>(Val) || isa<Second, Rest...>(Val);
}

The main difference is that variadic version of isa<>() expects at least two
template parameters explicitly. For isa_and_nonnull<>() the first template
parameter is already a variadic one.

The checker does not checks variadic_isa<>() correctly (it only checks the
first parameter) and crashes on isa_and_nonnull<>() because it tries to
retrieve the template parameter as a type which is a pack instead. This causes
an assertion.

In the test files there are no tests for isa_and_nonnull<>() and in the LLVM
test header the isa_and_nonnull<>() is implemented in a non-variadic way.</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>