Index: lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp =================================================================== --- lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp +++ lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp @@ -857,8 +857,9 @@ // To actually get the raw user input here, we have to cast our expression to // the LLVMUserExpression which exposes the right API. This should never fail // as we always have a ClangUserExpression whenever we call this. - LLVMUserExpression &llvm_expr = *static_cast(&m_expr); - CodeComplete CC(request, m_compiler->getLangOpts(), llvm_expr.GetUserText(), + ClangUserExpression *llvm_expr = dyn_cast(&m_expr); + assert(llvm_expr && "m_expr not an ClangUserExpression?"); + CodeComplete CC(request, m_compiler->getLangOpts(), llvm_expr->GetUserText(), typed_pos); // We don't need a code generator for parsing. m_code_generator.reset();