Description
Environment
- OS and Version: macOS Sequoia 15.5
- VS Code Version: 1.100.3
- C/C++ Extension Version: 1.25.3
- If using SSH remote, specify OS of remote machine: Ubuntu 20.04.6 LTS
Bug Summary and Steps to Reproduce
Bug Summary:
When given a minimal program which initializes a static instance of a class inside a GCC statement expression, Intellisense produces an error squiggle while the program compiles cleanly in GCC. This is using GCC 10.5.0 on Ubuntu 20.04 (x86_64).
Steps to reproduce:
Create a CMake project with a single C++ file with this content:
class ValueContainer
{
public:
ValueContainer(int value) : value_(value) {}
private:
int value_;
};
#define DO_SOMETHING(value) (({ \
static ValueContainer foo{value}; \
&foo; \
}))
int main()
{
DO_SOMETHING(1);
return 0;
}
Enable the VSCode C++ and CMake Tools extensions on the project.
An error squiggle is seen at line 17 with the message "a dynamically-initialized local static variable is not allowed inside of a statement expressionC/C++(1232)".
The program compiles cleanly with no warnings with GCC either invoked from the command line or via the CMake Tools extension.
Expected behavior:
VS Code produces no error squiggles
Configuration and Logs
C++ configured automatically through CMake Tools, the default configuration. Here is a dump from the debug logs:
Custom browse configuration received: {
"browsePath": [
"/home/skearney/devenv-wip/vscode-cpp-test"
],
"compilerPath": "/usr/bin/X11/g++",
"compilerArgs": [],
"compilerFragments": [
"-g"
]
}
Other Extensions
No response
Additional context
No response