Environment
- OS and Version: Windows 10
- VS Code Version: 1.96.3
- C/C++ Extension Version: 1.22.11
Bug Summary and Steps to Reproduce
Bug Summary:
Create a simple C++ source file (e.g. hello.cpp) that uses some C++20 features, e.g. just #include <span> and define a dummy function that takes a std::span as parameter. Whatever.
Try to compile and run the code.
The error message says:
The contents of <span> are available only with C++20 or later.
Inspecting the command line, it's clear that the compiler flag to activate C++20 is not present.
Starting build...
cmd /c chcp 65001>nul && cl.exe /Zi /EHsc /nologo /FeC:\Users\Giovanni\Demos\CppTests\hello.exe C:\Users\Giovanni\Demos\CppTests\hello.cpp
The C++20 flag is present in both the C/C++ configuration UI and in the c_cpp_properties.json.
Screenshots attached below.



Configuration and Logs
{
"configurations": [
{
"name": "Win32",
"includePath": [
"${workspaceFolder}/**"
],
"defines": [
"_DEBUG",
"UNICODE",
"_UNICODE"
],
"windowsSdkVersion": "10.0.18362.0",
"compilerPath": "cl.exe",
"cStandard": "c17",
"cppStandard": "c++20",
"intelliSenseMode": "windows-msvc-x64"
}
],
"version": 4
}
Other Extensions
No response
Additional context
No response