vscode-cpptools
vscode-cpptools copied to clipboard
class "_PEB::<unnamed>" has no field "ImageUsedLargePages"
Environment
- OS and Version: win10
- VS Code Version: 1.90.2
- C/C++ Extension Version: 1.20.5
Bug Summary and Steps to Reproduce
Bug Summary:
#include <windows.h>
typedef struct _PEB
{
union
{
BOOLEAN SpareBool; // 3.51 to early 5.2
union // late 5.2 and higher
{
UCHAR BitField_0x03;
struct
{
// 0x01
UCHAR ImageUsedLargePages : 1; // late 5.2 and higher
UCHAR SpareBits_0x03_00 : 7;
};
};
};
} PEB, PPEB;
int main()
{
PEB peb{.ImageUsedLargePages = 1};
return 0;
}
Configuration and Logs
cl -std:c++20 test.cpp can compile
{
"configurations": [
{
"name": "Win32",
"includePath": [
"${workspaceFolder}/**"
],
"defines": [
"_DEBUG",
"UNICODE",
"_UNICODE"
],
"windowsSdkVersion": "10.0.26100.0",
"compilerPath": "cl.exe",
"cStandard": "c23",
"cppStandard": "c++23",
"intelliSenseMode": "windows-msvc-x64"
}
],
"version": 4
}
Other Extensions
No response
Additional context
No response
It looks like you are using the incorrect syntax, after changing the line
PEB peb{.ImageUs·edLargePages = 1};
to
PEB peb{1};
The error disappeared and the code compiled correctly.
It looks like you are using the incorrect syntax, after changing the line
PEB peb{.ImageUs·edLargePages = 1};to
PEB peb{1};The error disappeared and the code compiled correctly.
it's c++20 syntax
There seems to be a problem with the levels of nested fields in the IntelliSense. .SpareBool and .BitField_0x03 work fine. The fields inside the struct are found by auto-complete and are suggested as expected, but are flagged as errors by the IntelliSense compiler once used. This is a bug with IntelliSense.
This issue has been reported to our internal team (VS: 2100479). Please follow this issue for more updates on when a fix has been introduced.