microsoft / vscode

Visual Studio Code
https://code.visualstudio.com
MIT License
163.74k stars 29.1k forks source link

cppStandard setting not working #189876

Closed atomlin closed 1 year ago

atomlin commented 1 year ago

Type: Bug

setting c++ standard to c++17 in settings dialog for remote [WSL: Ubuntu-22:04]. Opened in settings.json shows "C_Cpp.default.cppStandard": "c++17",

C++ log diagnostics:

-------- Diagnostics - 8/7/2023, 4:11:29 PM
Version: 1.16.3
Current Configuration:
{
    "name": "Linux",
    "includePath": [
        "/home/atomlin/ws/flash/**",
        "/usr/local/systemc-2.3.4/**"
    ],
    "defines": [],
    "compilerPath": "/usr/bin/clang",
    "cStandard": "c17",
    "cppStandard": "c++14",
    "intelliSenseMode": "linux-clang-x64",
    "configurationProvider": "ms-vscode.makefile-tools",
    "compilerPathIsExplicit": true,
    "cStandardIsExplicit": true,
    "cppStandardIsExplicit": true,
    "intelliSenseModeIsExplicit": true,
    "compilerPathInCppPropertiesJson": "/usr/bin/clang",
    "configurationProviderInCppPropertiesJson": "ms-vscode.makefile-tools",
    "mergeConfigurations": false,
    "browse": {
        "path": [
            "${workspaceFolder}/**",
            "/usr/local/systemc-2.3.4/**"
        ],
        "limitSymbolsToIncludedHeaders": true
    }
}
cpptools version (native): 1.16.3.0
Translation Unit Mappings:
[ /home/atomlin/ws/flash/mdl/ftl/gcMgr.cpp ]:
    /home/atomlin/ws/flash/mdl/ftl/gcMgr.cpp
Translation Unit Configurations:
[ /home/atomlin/ws/flash/mdl/ftl/gcMgr.cpp ]:
    Process ID: 372506
    Memory Usage: 246 MB
    Compiler Path: /usr/bin/clang
    Includes:
        /usr/include/c++/11
        /usr/include/x86_64-linux-gnu/c++/11
        /usr/include/c++/11/backward
        /usr/lib/llvm-14/lib/clang/14.0.0/include
        /usr/local/include
        /usr/include/x86_64-linux-gnu
        /usr/include
        /home/atomlin/ws/flash/builder/systemC/common
        /usr/local/systemc-2.3.4/include
        /home/atomlin/ws/flash/mdl/top
    Standard Version: c++14
    IntelliSense Mode: linux-clang-x64
    Other Flags:
        --clang
        --clang_version=140000
Total Memory Usage: 246 MB

------- Workspace parsing diagnostics -------
Number of files discovered (not excluded): 21580

------- Potential include path issues --------
Some headers exist in multiple locations. If IntelliSense is behaving incorrectly,
try adding one of the alternate paths to the "includePath" in your configuration in
c_cpp_properties.json to override the automatic path discovery for that header.

Using: /usr/include/boost/config.hpp
    Alternative: "/usr/local/systemc-2.3.4/include/sysc/packages"

VS Code version: Code 1.81.0 (6445d93c81ebe42c4cbd7a60712e0b17d9463e97, 2023-08-02T12:37:13.485Z) OS version: Windows_NT x64 10.0.22621 Modes: Remote OS version: Linux x64 5.15.90.1-microsoft-standard-WSL2

System Info |Item|Value| |---|---| |CPUs|AMD Ryzen 9 5900X 12-Core Processor (24 x 3700)| |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
video_decode: enabled
video_encode: enabled
vulkan: disabled_off
webgl: enabled
webgl2: enabled
webgpu: enabled| |Load (avg)|undefined| |Memory (System)|63.93GB (34.54GB free)| |Process Argv|--crash-reporter-id 53a3bca4-5530-4057-99d0-2e9ea1d78930| |Screen Reader|no| |VM|0%| |Item|Value| |---|---| |Remote|WSL: Ubuntu-22.04| |OS|Linux x64 5.15.90.1-microsoft-standard-WSL2| |CPUs|AMD Ryzen 9 5900X 12-Core Processor (24 x 3700)| |Memory (System)|31.31GB (26.84GB free)| |VM|0%|
Extensions (17) Extension|Author (truncated)|Version ---|---|--- remote-wsl|ms-|0.81.0 vscode-sqlite|ale|0.14.1 asciidoctor-vscode|asc|3.1.3 gitlens|eam|14.2.0 copilot|Git|1.101.317 plantuml|jeb|2.17.5 git-graph|mhu|1.30.0 python|ms-|2023.14.0 vscode-pylance|ms-|2023.8.10 cmake-tools|ms-|1.14.34 cpptools|ms-|1.16.3 cpptools-extension-pack|ms-|1.3.0 hexeditor|ms-|1.9.12 makefile-tools|ms-|0.7.0 veriloghdl|msh|1.11.11 cmake|twx|0.0.17 vscode-lldb|vad|1.9.2 (2 theme extensions excluded)
A/B Experiments ``` vsliv368cf:30146710 vsreu685:30147344 python383:30185418 vspor879:30202332 vspor708:30202333 vspor363:30204092 vslsvsres303:30308271 vserr242:30382549 pythontb:30283811 vsjup518:30340749 pythonptprofiler:30281270 vshan820:30294714 vstes263:30335439 vscorecescf:30445987 vscod805cf:30301675 binariesv615:30325510 bridge0708:30335490 bridge0723:30353136 vsaa593:30376534 pythonvs932:30410667 vsclangdf:30486550 c4g48928:30535728 dsvsc012cf:30540253 pynewext54:30695312 azure-dev_surveyone:30548225 vscccc:30803845 282f8724:30602487 89544117:30613380 showlangstatbar:30737416 vsctsb:30748421 03d35959:30757346 pythonfmttext:30731395 pythoncmv:30756943 fixshowwlkth:30771522 showindicator:30805244 pythongtdpath:30769146 i26e3531:30792625 gsofa:30804715 pythonnosmt12:30797651 pythonidxpt:30805730 pythonnoceb:30805159 e537b577:30795824 dsvsc013:30795093 dsvsc014:30804076 ```
atomlin commented 1 year ago

Note that User, Remote and Workspace all have c++17 selected, but the log diagnostics shows c++14. The intelliSence shows red squigglies on

auto [a, b] = fn();

where fn returns a tuple (C++17 feature). Note that code compiles without error

atomlin commented 1 year ago

Ok, it seems there is also a c_cpp_properties.json file in the .vscode directory which overrides which has "cppStandard": "c++14"