microsoft / microsoft/vscode-cpptools

std::initializer_list does not contain the expected constructor

Open
#12,275 16 comments 8 reactions 1 assignee View on GitHub

Nobody has claimed this yet.

Feature: Configuration Language Service verified
Dominant language
TypeScript
Stars
6.2k
Forks
1.7k
Avg merge
14h 46m
Merged PRs (30d)
61

Description

Type: Bug

Create the following .cpp file:

#include <vector>

int main()
{
    std::vector<int> v {1, 2, 3};
    return 0;
}

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)".

Screenshot 2024-05-03 at 18 09 20

clang version:

$ clang -v
Homebrew clang version 18.1.4
Target: x86_64-apple-darwin23.3.0
Thread model: posix
InstalledDir: /usr/local/opt/llvm/bin

c_cpp_properties.json:

{
    "configurations": [
        {
            "name": "Mac",
            "includePath": [
                "${workspaceFolder}/**"
            ],
            "macFrameworkPath": [
                "/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/System/Library/Frameworks"
            ],
            "compilerPath": "/usr/local/opt/llvm/bin/clang",
            "cppStandard": "c++17",
            "intelliSenseMode": "macos-clang-x64"
        }
    ],
    "version": 4
}

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
Item Value
CPUs Intel(R) Core(TM) i5-1038NG7 CPU @ 2.00GHz (8 x 2000)
GPU Status 2d_canvas: enabled
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
Load (avg) 3, 4, 3
Memory (System) 16.00GB (2.14GB free)
Process Argv --crash-reporter-id 7575e86b-e434-484d-8645-89363df807c7
Screen Reader no
VM 0%
A/B Experiments
vsliv368cf:30146710
vspor879:30202332
vspor708:30202333
vspor363:30204092
vscorecescf:30445987
vscod805:30301674
binariesv615:30325510
vsaa593:30376534
py29gd2263:31024239
c4g48928:30535728
azure-dev_surveyone:30548225
a9j8j154:30646983
962ge761:30959799
pythongtdpath:30769146
welcomedialogc:30910334
pythonidxpt:30866567
pythonnoceb:30805159
asynctok:30898717
pythontestfixt:30902429
pythonregdiag2:30936856
pyreplss1:30897532
pythonmypyd1:30879173
pythoncet0:30885854
h48ei257:31000450
pythontbext0:30879054
accentitlementst:30995554
dsvsc016:30899300
dsvsc017:30899301
dsvsc018:30899302
cppperfnew:31000557
ccp1r6:30993540
dsvsc020:30976470
pythonait:31006305
chatpanelt:31018789
dsvsc021:30996838
0ee40948:31013168
pythoncenvpt:31022790
a69g1124:31038041
dwnewjupytercf:31035177

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.