<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/118191>118191</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
Clang Language Server Crash When Using C++26 and Experimental Compile Options
</td>
</tr>
<tr>
<th>Labels</th>
<td>
clang
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
ZtRXR
</td>
</tr>
</table>
<pre>
### Title: Clang Language Server Crash When Using C++26 and Experimental Compile Options
**Description:**
I encountered a crash with the Clang Language Server while trying to compile a simple C++ project using C++26 and an experimental compile option. Below are the details of my project and the error output that occurred.
**Environment:**
- OS: Windows
- Clangd version: 19.1.4
- CMake version: 3.10
- Visual Studio 2022
**CMakeLists.txt:**
```cmake
cmake_minimum_required(VERSION 3.10)
project(hello_world)
set(CMAKE_CXX_STANDARD 26)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
add_compile_options(-fexperimental-new-constant-interpreter)
add_executable(hello_world main.cpp)
```
**main.cpp:**
```cpp
#include <cstdint>
#include <iostream>
#include <vector>
using namespace std;
using ll = int64_t;
vector<pair<ll,ll>> v[ll(1e5+5)];
int main(){
cout<<"hello world\n";
}
```
**Error Log:**
During compilation, the Clang Language Server crashed multiple times, outputting the following error:
```
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace.
Stack dump:
0. C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.42.34433\include\ppltasks.h:676:124: current parser token ')'
1. C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.42.34433\include\ppltasks.h:95:1: parsing namespace 'Concurrency'
... [more stack frames]
[Error - 11:13:32] 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.
```
**Steps to Reproduce:**
1. Create a directory and add the above `CMakeLists.txt` and `main.cpp`.
2. Build the project using CMake and initiate the Clang Language Server.
3. Observe the crash and error logs.
**Expected Behavior:**
The Clang Language Server should not crash, and the project should compile successfully.
**Additional Notes:**
- The crash seems related to parsing issues in the `ppltasks.h` header file.
- The issue persists despite using a stable version of Clangd and CMake.
Please let me know if you need further information to investigate this issue. Thank you!
logs
```
[Info - 11:13:29] Connection to server got closed. Server will restart.
I[11:13:30.032] clangd version 19.1.4
I[11:13:30.032] Features: windows
I[11:13:30.032] PID: 4316
I[11:13:30.033] Working directory: c:\dev\cpp\helloworld
I[11:13:30.033] argv[0]: C:\dev\cpp\clang\bin\clangd.exe
I[11:13:30.041] Starting LSP over stdin/stdout
I[11:13:30.041] <-- initialize(0)
I[11:13:30.042] --> reply:initialize(0) 1 ms
I[11:13:30.044] <-- initialized
I[11:13:30.046] <-- textDocument/didOpen
I[11:13:30.047] Loaded compilation database from c:\dev\cpp\helloworld\build/compile_commands.json
I[11:13:30.047] ASTWorker building file c:\dev\cpp\helloworld\main.cpp version 101 with command
[C:/dev/cpp/helloworld/build]
"C:\\dev\\cpp\\clang\\bin\\clang++.exe" --driver-mode=g++ -O0 -g -Xclang -gcodeview -D_DEBUG -D_DLL -D_MT -Xclang --dependent-lib=msvcrtd -std=gnu++26 -fexperimental-new-constant-interpreter -o CMakeFiles/hello_world.dir/main.cpp.obj -c "-resource-dir=C:\\dev\\cpp\\clang\\lib\\clang\\19" -- "c:\\dev\\cpp\\helloworld\\main.cpp"
I[11:13:30.048] --> window/workDoneProgress/create(0)
I[11:13:30.048] Enqueueing 1 commands for indexing
I[11:13:30.049] <-- reply(0)
I[11:13:30.049] --> $/progress
I[11:13:30.049] --> $/progress
I[11:13:30.056] <-- textDocument/documentSymbol(1)
I[11:13:30.057] <-- textDocument/codeAction(2)
I[11:13:30.061] --> textDocument/clangd.fileStatus
I[11:13:30.068] <-- textDocument/documentLink(3)
I[11:13:30.068] <-- textDocument/inlayHint(4)
I[11:13:30.161] --> $/progress
I[11:13:30.161] --> $/progress
I[11:13:30.269] <-- textDocument/foldingRange(5)
I[11:13:30.270] --> reply:textDocument/foldingRange(5) 0 ms
I[11:13:30.356] <-- textDocument/documentSymbol(6)
I[11:13:30.361] <-- textDocument/semanticTokens/full(7)
I[11:13:30.685] Built preamble of size 11708152 for file c:\dev\cpp\helloworld\main.cpp version 101 in 0.62 seconds
I[11:13:30.685] --> workspace/semanticTokens/refresh(1)
I[11:13:30.685] --> textDocument/clangd.fileStatus
I[11:13:30.686] Indexing c++23 standard library in the context of c:\dev\cpp\helloworld\main.cpp
I[11:13:30.687] <-- reply(1)
I[11:13:30.819] --> textDocument/publishDiagnostics
I[11:13:30.819] --> textDocument/inactiveRegions
I[11:13:30.819] --> reply:textDocument/documentSymbol(1) 763 ms
I[11:13:30.819] --> reply:textDocument/codeAction(2) 762 ms
I[11:13:30.819] --> reply:textDocument/documentLink(3) 751 ms
I[11:13:30.819] --> reply:textDocument/inlayHint(4) 751 ms
I[11:13:30.820] --> reply:textDocument/documentSymbol(6) 463 ms
I[11:13:30.820] --> reply:textDocument/semanticTokens/full(7) 458 ms
I[11:13:30.820] --> textDocument/clangd.fileStatus
I[11:13:31.296] <-- textDocument/semanticTokens/full/delta(8)
I[11:13:31.296] --> reply:textDocument/semanticTokens/full/delta(8) 0 ms
I[11:13:31.296] --> textDocument/clangd.fileStatus
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace.
Stack dump:
0. C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.42.34433\include\ppltasks.h:676:124: current parser token ')'
1. C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.42.34433\include\ppltasks.h:95:1: parsing namespace 'Concurrency'
2. C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.42.34433\include\ppltasks.h:156:1: parsing namespace 'Concurrency::details'
3. C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.42.34433\include\ppltasks.h:671:5: parsing struct/union/class body 'Concurrency::details::_ResultHolder<std::vector<bool>>'
4. C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.42.34433\include\ppltasks.h:674:9: parsing function body 'Concurrency::details::_ResultHolder<std::vector<bool>>::Set'
5. C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.42.34433\include\ppltasks.h:674:9: in compound statement ('{}')
6. C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.42.34433\include\algorithm:3734:21: instantiating function definition 'std::transform<std::_Vb_const_iterator<std::_Wrap_alloc<std::allocator<unsigned int>>>, std::_Vector_iterator<std::_Vector_val<std::_Simple_types<char>>>, (lambda at C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.42.34433\include\ppltasks.h:676:75)>'
[Error - 11:13:32] 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.
```
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJzsWltv4ziy_jXMS8GCRFm-POTBlu0zjZO-nDjT3TgvBi2VbU4oUkNSTjK_fkFSduy0lc70zqJnsQsIsS2Sxa8uX1VRCjOGbyXiNcmmJJtdscbulL7-f3v79fZqrcqna0LTcMEdtwJJOoFcMLmFGya3DdsiLFHvUUOumdnBlx1K-NVwuYWc0CmhUzoAJkuYP9aoeYXSMgG5qmouED7WlitpSDxxF3XXDE2hub9P0vZeGH8HKAvVSIsaS2BQ-A0fuN2B3WEHqoed28fqJ4fIKijanRkYXtUCDyih1uo3LCw0F7AzCXgK_yBEeZgRTFGoB2AaPZASLePCgNpA9XSU6-S4UdRaaVCNrRsLdscsqKJotMYyOjXDXO65VtJteGqGHnxcOhd84bJUD8bf8YqXsEdtgtEgGUdJ1A-D79k9no6lURL7kc_cNEzA0jYlV0BjSk_39-tuuLEmso9nEMggDldRsXsk8cR_riouedVUK42_N1xjSejo8_x2-e7jh7AlHQfxrT0IHe1QCLV6UFqUx1GDbiR_P_nf-Sr_-nW1vJt8mE1uZ0AHYU7XhNXt_P9-fXc7n8HHD2EmK8tV66iVauO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