New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
std::initializer_list does not contain the expected constructor #12275
Comments
@Unturned3 I don't repro the issue with the latest Apple clang (you're using the newer LLVM non-Apple clang though). Can you run the C/C++: Log Diagnostics command after opening the source file? |
Hmm.. strange. I replaced Anyways, here's the C/C++: Log Diagonistics output:
|
@Unturned3 I'm not sure. I know a similar error can occur if c++03 is used. Are you able to compile/link? Have you tried changing it to /usr/local/opt/llvm/bin/clang++? If you use go to def on either the |
Yes, I am able to compile & link with the Homebrew clang just fine. No errors/warnings. I tried setting the compilerPath to |
This happens on Windows with msys clang 18.1.3 as well. Apparently, the error appears only when To reproduce, create an empty workspace and write a simple C++ code: // The error only appears if initializer_list is included before vector
#include <initializer_list>
#include <vector>
int main() {
std::vector<int> v{1, 2, 3};
return 0;
} c_cpp_properties.json: {
"configurations": [
{
"name": "Win32",
"includePath": [
"${workspaceFolder}/**"
],
"defines": [],
"compilerPath": "C:\\\\msys64\\\\clang64\\\\bin\\\\x86_64-w64-mingw32-clang++.exe",
"intelliSenseMode": "windows-clang-x64",
"cStandard": "c17",
"cppStandard": "c++17",
"compilerArgs": [
"--std=c++17"
]
}
],
"version": 4
} C/C++: Log Diagnostics:
|
@Unturned3 @MinetaS Does the issue persist when changing your IntelliSense Mode to *-clang-x86? |
@browntarik Yes, for windows-clang-x86 the issue persists. Along with the compiler path set to |
Type: Bug
Create the following
.cpp
file:A red error squiggle will appear before the vector's uniform initialization list, with the message "the definition of std::initializer_list does not contain the expected constructor C/C++(2348)".
clang version:
c_cpp_properties.json:
Extension version: 1.20.4
VS Code version: Code 1.88.1 (e170252f762678dec6ca2cc69aba1570769a5d39, 2024-04-10T17:42:52.765Z)
OS version: Darwin x64 23.3.0
Modes:
System Info
canvas_oop_rasterization: disabled_off
direct_rendering_display_compositor: disabled_off_ok
gpu_compositing: enabled
multiple_raster_threads: enabled_on
opengl: enabled_on
rasterization: enabled
raw_draw: disabled_off_ok
skia_graphite: disabled_off
video_decode: enabled
video_encode: enabled
webgl: enabled
webgl2: enabled
webgpu: enabled
A/B Experiments
The text was updated successfully, but these errors were encountered: