Skip to content

intelliSense show incorrect sizeof #13375

@NTLPY

Description

@NTLPY

Environment

  • OS and Version: Windows 11
  • VS Code Version: 1.98.2
  • C/C++ Extension Version: v1.23.6
  • If using SSH remote, specify OS of remote machine: NO

Bug Summary and Steps to Reproduce

Bug Summary:
Incorrect output of sizeof

Env:

  1. g++.exe (x86_64-win32-seh-rev0, Built by MinGW-Builds project) 14.2.0

Steps to reproduce:

  1. Create file tmp.cpp:
#include <iostream>

using namespace std;

struct foo
{
    int a;
    __uint128_t b;
};

int
main()
{
    cout << sizeof(foo) << endl;
    return 0;
}
  1. Move cursor to sizeof(foo), which says (unsigned long long)24ULL
  2. g++ -o tmp.exe tmp.cpp && ./tmp.exe

Output: 32

Configuration and Logs

c_cpp_properties.json:

{
    "configurations": [
        {
            "name": "Win32",
            "includePath": [
                "${workspaceFolder}/**"
            ],
            "defines": [
                "_DEBUG",
                "UNICODE",
                "_UNICODE"
            ],
            "compilerPath": "${default}",
            "cStandard": "c17",
            "cppStandard": "gnu++17",
            "intelliSenseMode": "windows-gcc-x64"
        }
    ],
    "version": 4
}

Diag:
-------- Diagnostics - 3/14/2025, 9:12:10 PM
Version: 1.23.6
Current Configuration:
{
    "name": "Win32",
    "includePath": [
        "@@@/**"
    ],
    "defines": [
        "_DEBUG",
        "UNICODE",
        "_UNICODE"
    ],
    "compilerPath": "@@@\\mingw64\\bin\\gcc.exe",
    "cStandard": "c17",
    "cppStandard": "gnu++17",
    "intelliSenseMode": "windows-gcc-x64",
    "compilerPathIsExplicit": true,
    "cStandardIsExplicit": true,
    "cppStandardIsExplicit": true,
    "intelliSenseModeIsExplicit": true,
    "compilerPathInCppPropertiesJson": "${default}",
    "macFrameworkPath": [],
    "mergeConfigurations": false,
    "browse": {
        "path": [
            "@@@/**",
            "${workspaceFolder}"
        ],
        "limitSymbolsToIncludedHeaders": true
    }
}
Modified Settings:
{
    "C_Cpp.autoAddFileAssociations": false
}
Additional Tracked Settings:
{
    "editorTabSize": 4,
    "editorInsertSpaces": true,
    "editorAutoClosingBrackets": "languageDefined",
    "filesEncoding": "utf8",
    "filesAssociations": {
        "*.embeddedhtml": "html",
        ".clang-format": "yaml",
        ".clang-tidy": "yaml",
        "*.drawio": "xml",
        "py": "shellscript"
    },
    "filesExclude": {
        "**/.git": true,
        "**/.svn": true,
        "**/.hg": true,
        "**/.DS_Store": true,
        "**/Thumbs.db": true
    },
    "filesAutoSaveAfterDelay": false,
    "editorInlayHintsEnabled": true,
    "editorParameterHintsEnabled": true,
    "searchExclude": {
        "**/node_modules": true,
        "**/bower_components": true,
        "**/*.code-search": true
    },
    "workbenchSettingsEditor": "ui"
}
cpptools version (native): 1.23.6.0
Current database path: @@@\APPDATA\LOCAL\MICROSOFT\VSCODE-CPPTOOLS\8C1C22839CFEA9FBF4F53587E43CC58C\.BROWSE.VC.DB
No active translation units.

Other Extensions

No response

Additional context

No response

Metadata

Metadata

Assignees

Labels

Language ServiceWorks in VSSo we'd need to fix it for VS Code to reach parity.bugfixedCheck the Milestone for the release in which the fix is or will be available.quick fix

Type

Projects

Status

Done

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions