microsoft / vscode-cpptools

Official repository for the Microsoft C/C++ extension for VS Code.
Other
5.52k stars 1.55k forks source link

IntelliSense: constexpr give wrong result. #11916

Open llcxiongmao opened 9 months ago

llcxiongmao commented 9 months ago

Environment

Bug Summary and Steps to Reproduce

constexpr give wrong result.

#include <cstdio>
#include <memory>

int main(int argc, char* argv[]) {
    constexpr const size_t t0 = sizeof(std::unique_ptr<int>);
    printf("t0: %zu\n", t0);
    return 0;
}

IntelliSense show 16, but actually it is 8. 截图 2024-02-02 23-58-52

Configuration and Logs

Log:
-------- Diagnostics - 2024/2/3 00:06:58
Version: 1.19.2
Current Configuration:
{
    "name": "Linux",
    "includePath": [
        "/home/llc/下载/my/test0/**"
    ],
    "defines": [],
    "compilerPath": "/usr/bin/clang",
    "cStandard": "c17",
    "cppStandard": "c++14",
    "intelliSenseMode": "linux-clang-x64",
    "compilerPathInCppPropertiesJson": "/usr/bin/clang",
    "intelliSenseModeIsExplicit": false,
    "cStandardIsExplicit": false,
    "cppStandardIsExplicit": false,
    "mergeConfigurations": false,
    "compilerPathIsExplicit": false,
    "configurationProvider": "ms-vscode.cmake-tools",
    "browse": {
        "path": [
            "/home/llc/下载/my/test0/**",
            "${workspaceFolder}"
        ],
        "limitSymbolsToIncludedHeaders": true
    }
}
Custom browse configuration: 
{
    "browsePath": [
        "/home/llc/下载/my/3rd/boost_1_84_0",
        "/home/llc/下载/my/test0"
    ],
    "compilerPath": "/usr/bin/g++",
    "compilerArgs": [],
    "compilerFragments": [
        "-g -std=gnu++17"
    ]
}
cpptools version (native): 1.19.2.0
Translation Unit Mappings:
[ /home/llc/下载/my/test0/Main.cpp - source TU]:
Translation Unit Configurations:
[ /home/llc/下载/my/test0/Main.cpp ]:
    Process ID: 7035
    Memory Usage: 58 MB
    Compiler Path: /usr/bin/g++
    Includes:
        /home/llc/下载/my/3rd/boost_1_84_0
        /usr/include/c++/11
        /usr/include/x86_64-linux-gnu/c++/11
        /usr/include/c++/11/backward
        /usr/lib/gcc/x86_64-linux-gnu/11/include
        /usr/local/include
        /usr/include/x86_64-linux-gnu
        /usr/include
    Standard Version: c++17
    IntelliSense Mode: linux-gcc-x64
    Other Flags:
        --g++
        --gnu_version=110400
Total Memory Usage: 58 MB

------- Workspace parsing diagnostics -------
Number of files discovered (not excluded): 83034
Number of files parsed: 36252

Other Extensions

No response

Additional context

No response

browntarik commented 8 months ago

Thank you for reporting this bug, this seems to be an issue with our IntelliSense support within the extension. Please track this issue for further updates on when a fix is made.

browntarik commented 7 months ago

This issue has now been reduced and reported to our internal IntelliSense Team (2003330). Please track this issue to receive further updates on when it has been addressed.