<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 - Assertion failure in clang::Expr::getBestDynamicClassType (via optin.cplusplus.VirtualCall SA checker)"
   href="https://bugs.llvm.org/show_bug.cgi?id=34451">34451</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Assertion failure in clang::Expr::getBestDynamicClassType (via optin.cplusplus.VirtualCall SA checker)
          </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>Linux
          </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>Static Analyzer
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>alexfh@google.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>$ cat getBestDynamicClassType-crash.cc
class a {
 public:
  void b() const;
};
class c {
  int m_fn2() const;
  a d[];
};
int c::m_fn2() const { d->b(); }
$ clang-tidy -checks=-*,clang-analyzer-optin.cplusplus.VirtualCall
getBestDynamicClassType-crash.cc -- -std=c++11
assert.h assertion failed at llvm/include/llvm/Support/Casting.h:241 in
typename std::enable_if<!is_simple_type<Y>::value, typename cast_retty<X, const
Y>::ret_type>::type llvm::cast(const Y &) [X = clang::RecordType, Y =
clang::QualType]: isa<X>(Val) && "cast<Ty>() argument of incompatible type!"
    @          0x544749a  __assert_fail
    @          0x1adcd36  llvm::cast<>()
    @          0x2d43339  clang::Type::castAs<>()
    @          0x40913d7  clang::Expr::getBestDynamicClassType()
    @          0x28346d0  isVirtualCall()
    @          0x283412c  (anonymous
namespace)::VirtualCallChecker::checkPreCall()
    @          0x2834030  clang::ento::check::PreCall::_checkCall<>()
    @          0x2e03982  clang::ento::CheckerFn<>::operator()()
    @          0x2df971a  (anonymous namespace)::CheckCallContext::runChecker()
    @          0x2df670e  expandGraphWithCheckers<>()
    @          0x2df6460 
clang::ento::CheckerManager::runCheckersForCallEvent()
    @          0x2e57bf5  clang::ento::CheckerManager::runCheckersForPreCall()
    @          0x2e5a297  clang::ento::ExprEngine::evalCall()
    @          0x2e5a19b  clang::ento::ExprEngine::VisitCallExpr()
    @          0x2e12f24  clang::ento::ExprEngine::Visit()
    @          0x2e0fe44  clang::ento::ExprEngine::ProcessStmt()
    @          0x2e0faca  clang::ento::ExprEngine::processCFGElement()
    @          0x2e3dc66  clang::ento::CoreEngine::HandlePostStmt()
    @          0x2e3d566  clang::ento::CoreEngine::dispatchWorkItem()
    @          0x2e3d0a8  clang::ento::CoreEngine::ExecuteWorkList()
    @          0x2138e05  clang::ento::ExprEngine::ExecuteWorkList()
    @          0x20e1802  (anonymous
namespace)::AnalysisConsumer::ActionExprEngine()
    @          0x20e15c1  (anonymous
namespace)::AnalysisConsumer::RunPathSensitiveChecks()
    @          0x20e1285  (anonymous namespace)::AnalysisConsumer::HandleCode()
    @          0x20d4963  (anonymous
namespace)::AnalysisConsumer::HandleDeclsCallGraph()
    @          0x20d2be7  (anonymous
namespace)::AnalysisConsumer::HandleTranslationUnit()
    @          0x25136ce  clang::MultiplexConsumer::HandleTranslationUnit()
    @          0x2f59506  clang::ParseAST()
    @          0x250109a  clang::ASTFrontendAction::ExecuteAction()

Devin, assigning to you, as the latest to make a significant change in this
code.</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>