You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

VSCode中Clangd服务处理std::ranges::count_if时崩溃

Clangd在VSCode中解析特定代码行时持续崩溃

问题描述

当VSCode中的Clangd服务尝试解析包含特定代码行的文件时,会持续崩溃。该行代码用于统计UTF-8字符串中除续字节外的字符数量,崩溃现象与文件其他内容无关。

可复现代码片段

return (wide ? wide_ulen(str) : std::ranges::count_if(str, [](char c) { return (static_cast<unsigned char>(c) & 0xC0) != 0x80; }));

日志信息

以下是开启--log=verbose参数后获取的Clangd日志:

I[15:44:33.191] <-- textDocument/documentSymbol(4)
I[15:44:33.827] --> textDocument/publishDiagnostics
[Error - 15:44:35] The Clang Language Server server crashed 5 times in the last 3 minutes. The server will not be restarted. See the output for more information.
[Error - 15:44:35] Request textDocument/documentSymbol failed.
[object Object]
[Error - 15:44:35] Request textDocument/documentLink failed.
[object Object]
[Error - 15:44:35] Request textDocument/codeAction failed.
[object Object]
[Error - 15:44:35] Request textDocument/documentSymbol failed.
[object Object]
[Error - 15:44:35] Request textDocument/codeAction failed.
[object Object]

系统信息

  • Clangd版本:clangd version 10.0.0-4ubuntu1
  • Clangd扩展版本:v0.1.28
  • 操作系统:Ubuntu Linux 20.04

VSCode报告的错误

  • vscode source:clangd:与服务器的连接已关闭,服务器将不再重启。
  • Client Clang Language Server:与服务器的连接出现错误,正在关闭服务器。

内容的提问来源于stack exchange,提问作者yuzhan wang

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.06.23 13:02:16