Local: Microsoft Windows 10 Pro Education 10.0.19041 Build 19041
Remote: WSL2 Ubuntu 20.04.3 LTS
VS Code Version: 1.59.1 system setup
C/C++ Extension Version: 1.6.0
Other extensions you installed (and if the issue persists after disabling them):
Local (enabled)
Remote Development Pack
Remote - WSL
Remote (enabled)
YAML
Clang-Format
If using SSH remote, specify OS of remote machine: NA
A clear and concise description of what the bug is, including information about the workspace (i.e. is the workspace a single project or multiple projects, size of the project, etc).
Single folder workspace (without workspace file).
After you change the c++ standard through the ui provided by the c++ extension, if you configure a default build task the "args" property does not include the "-std" argument which lets the compiler know which c++ version to use.
Steps to reproduce
Ctrl + Shift + P > C/C++: Edit Configurations (UI)
Change C++ standard to c++20
Create a main.cpp file in the folder
Ctrl + Shift + P > Tasks: Configure Default Build Task > C/C++: g++ build active file (compiler = /usr/bin/g++)
Note when tasks.json opens, the -std argument is missing under the args property
Add some c++ code that uses a c++20 feature in main.cpp
Ctrl + Shift + B
Compiler error
Expected behavior
At step 5, there should be a -std argument in the args property of the task that is set to the c++ standard selected by the user.
If none is selected through the UI, then it should match the default one that you can set through vscodes settings UI under extensions > C/C++.
If that is not set, then it should use intellisense default standard.
Code sample and logs
Code sample
#include <iostream>
#include <iterator> // for std::size
int main()
{
char myString[]{ "string" };
const int length{ static_cast(std::size(myString)) };
// const int length{ sizeof(myString) / sizeof(myString[0]) }; // use instead if not C++17 capable
std::cout << myString << " has " << length << " characters.\n";
for (int index{ 0 }; index < length; ++index)
std::cout << static_cast<int>(myString[index]) << ' ';
std::cout << '\n';
return 0;
------- Workspace parsing diagnostics -------
Number of files discovered (not excluded): 2843
- Logs from [the language server logging](https://code.visualstudio.com/docs/cpp/enable-logging-cpp#_enable-logging-for-the-language-server)
**Screenshots**
<!-- If applicable, add screenshots to help explain your problem. -->
**Additional context**
<!--
Providing call stacks:
For bugs like crashes, deadlocks, infinite loops, etc. that we are not able to repro and for which the call stack may be useful, please attach a debugger and/or create a dmp and provide the call stacks. Windows binaries have symbols available in VS Code by setting your "symbolSearchPath" to "https://msdl.microsoft.com/download/symbols".
Instructions for attaching debugger to language service process:
https://github.com/microsoft/vscode-cpptools/wiki/Attaching-debugger-to-cpptools-or-cpptools%E2%80%90srv.
Performance analysis:
For a performance issue see instructions at https://github.com/microsoft/vscode-cpptools/wiki/Troubleshooting-Performance-Issues.
-->
Bug type: Language Service
Describe the bug
Steps to reproduce
Ctrl + Shift + P
>C/C++: Edit Configurations (UI)
C++ standard
toc++20
main.cpp
file in the folderCtrl + Shift + P
>Tasks: Configure Default Build Task
>C/C++: g++ build active file
(compiler = /usr/bin/g++)-std
argument is missing under theargs
propertyCtrl + Shift + B
Expected behavior
At step 5, there should be a
-std
argument in theargs
property of the task that is set to the c++ standard selected by the user. If none is selected through the UI, then it should match the default one that you can set through vscodes settings UI under extensions > C/C++. If that is not set, then it should use intellisense default standard.Code sample and logs
int main() { char myString[]{ "string" }; const int length{ static_cast(std::size(myString)) };
// const int length{ sizeof(myString) / sizeof(myString[0]) }; // use instead if not C++17 capable
std::cout << myString << " has " << length << " characters.\n";
}
C/C++: Log Diagnostics
from the VS Code command palette------- Workspace parsing diagnostics ------- Number of files discovered (not excluded): 2843