Repository navigation
Description
Version
mcppls 0.23.0 (server and VS Code extension), bundled engine clangd 23.1.0-mcppls.12.
Editor
VS Code 1.147.0 (x64)
Operating system
Windows 11 Pro 10.0.26200
Build system
mcpp 2026.11.21.1; toolchain [email protected] with MSVC 14.52.37025, Windows SDK 10.0.26100.0; target x86_64-pc-windows-msvc.
Project: the default template of mcpplibs.mwrap.slint 1.19.0.3 (SDK compat.slint 1.19.0). It compiles and runs; only the language server reports errors.
What happened
Open src/main.cpp in a project created with
mcpp new demo --template [email protected]mcppls reports (on the #include <slint-platform.h> line and on the module workers):
In included file: no type named 'align_val_t' in namespace 'std'
.../compat-x-slint/1.19.0/mcpp_generated/slint/include/slint/private/vtable.h:135:52
module mcpplibs.mwrap.slint cannot be built because
mcpplibs.mwrap.slint.macros did not compile: no type named 'align_val_t' in namespace 'std'
The same project builds and runs normally (mcpp build, mcpp run, mcpp test).
Expected
No false diagnostics: the editor should not report errors for code that the project's own toolchain compiles.
Steps to reproduce
mcpp new demo --template [email protected]- Open
demo/src/main.cppin VS Code with mcppls. - Observe the diagnostics above;
mcpp buildsucceeds.
Analysis
This is a consequence of WA-CLANGD-005 (UP-05 in #24), not a new clangd defect.
- mcppls appends
-fno-aligned-allocationto every unit in the MSVC STL context. Verified in the synthesizedcompile_commands.json:src/main.cpp, the package'smacros.cppmand the generatedapp.cppmall carry it. - With that flag clang does not define
__cpp_aligned_new, and MSVC'svcruntime_new.hthen omitsstd::align_val_tand the alignedoperator new/deleteoverloads. - Slint 1.19's
slint/private/vtable.huses them unconditionally (VRc::makeat lines 134-135,vtable::deallocat lines 254-257), so clangd's module worker fails. - The real build does not pass the flag (mcpp's clang 23.1.3), so the same headers compile fine.
mcppls.disableWorkaround = ["WA-CLANGD-005"]is not a usable workaround: per clang 23.1.0: MSVC STLstdmodule fails withreference to 'align_val_t' is ambiguous(fixed in 23.1.1, llvm/llvm-project#218152) mcpp-community/mcpp#640 the option must match between a module and its importers, and turning it off brings backalign_val_tis ambiguous under MSVC in a module llvm/llvm-project#218152 for the MSVC STLstdmodule.
Verification
Guarding the two Slint sites with #if defined(__cpp_aligned_new) makes the error disappear:
-#if !defined(__APPLE__) || MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_14
+#if defined(__cpp_aligned_new) && (!defined(__APPLE__) || MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_14)
auto mem = ::operator new(sizeof(VRcInner<VTable, X>),
static_cast<std::align_val_t>(alignof(VRcInner<VTable, X>)));-#ifdef __cpp_sized_deallocation
+#if defined(__cpp_aligned_new) && defined(__cpp_sized_deallocation)
::operator delete(reinterpret_cast<void *>(ptr), layout.size,
static_cast<std::align_val_t>(layout.align));
-#elif !defined(__APPLE__) || MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_14
+#elif defined(__cpp_aligned_new) && (!defined(__APPLE__) || MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_14)With those guards, mcppls check src/main.cpp exits 0 with zero diagnostics; mcpp build is unchanged. So the false errors come from the workaround's flag, not from Slint parsing.
Request
- The upstream fix ships in clangd 23.1.1, which would drop WA-CLANGD-005 automatically. Could the bundled engine be upgraded?
- Until then, please document in the WA-005 entry / diagnostics docs that projects with headers using aligned allocation (Slint 1.19 is one) lose module semantics under this workaround, and that the reported errors are false positives while the build is fine.
- I can attach a diagnostic bundle and/or the small Slint-side patch if useful.
References
- Upstream defects register (clangd, mcpp) #24 (UP-05, WA-CLANGD-005)
align_val_tis ambiguous under MSVC in a module llvm/llvm-project#218152- clang 23.1.0: MSVC STL
stdmodule fails withreference to 'align_val_t' is ambiguous(fixed in 23.1.1, llvm/llvm-project#218152) mcpp-community/mcpp#640 - mcpplibs/slint-m (the package)
Activity
server 0.24.1, vscode 0.24.1: MSVC STL units keep aligned allocation …
Sunrisepeak commentedon Nov 23, 2026
插件市场已经更新最新版本0.24.1, 可以更新尝试