Open travbid opened 4 months ago
Thank you for sharing your repro steps, we will let you know if we need more information on the issue.
Probably related to this issue. Intellisense is completely broken with Clang 18 in WSL2.
The applied configuration for testing:
"configurations": [
{
"name": "Linux",
"includePath": [
"${workspaceFolder}/**"
],
"defines": [],
"compilerPath": "/usr/bin/clang++",
"intelliSenseMode": "linux-clang-x64",
"cStandard": "c17",
"cppStandard": "c++17"
}
]
In /usr/lib/llvm-18/lib/clang/18/include/stddef_size_t.h, Intellisense apparently is not aware of built-in macro `building_modulein Clang. There is [a similar question asked in stack overflow](https://stackoverflow.com/questions/78711961/vscodes-microsoft-c-c-intellisense-cant-figure-out-the-offsetof-macro) as well, which failed to define
offsetof`.
This bug impacts every header file that uses size_t
type.
Note that std::size_t
is defined but size_t
isn't. The error remains when stddef.h is included instead.
To reproduce:
#include <cstddef>
size_t N = 0;
@MinetaS, try adding this to your defines:
"defines": [
"__building_module(x)=0"
]
This solved it for me.
@travbid Fixed with https://github.com/microsoft/vscode-cpptools/releases/tag/1.22.4 .
Environment
Bug Summary and Steps to Reproduce
Bug Summary:
When using clang-18 with libc++ on Ubuntu, Intellisense erroneously reports
namespace "std" has no member
for some items.Compiling from the command line with the same command from
compile_commands.json
succeeds, so it is not (directly) an error with clang.Reproduction case: https://github.com/travbid/vscode-issue-repro/blob/master/main.cpp
Steps to reproduce:
-stdlib=libc++
to the buildcompile_commands.json
and set its path inc_cpp_properties.json
. (In the above reproduction link, you can replace/home/travers/Projects
incompile_commands.json
to paths that are valid on your machine)std
members can't be found, e.g.Expected behavior:
No red squiggles
Configuration and Logs
c_cpp_properties.json log_diagnostics.txt language_server.log
Other Extensions
No response
Additional context
The issue appears to be related to
size_t
not being defined in some cases, which in turn appears to be related to__building_module
(a clang built-in?) not being defined in/usr/lib/llvm-18/lib/clang/18/include/__stddef_size_t.h
:Building from command line builds successfully: