Skip to content

IntelliSense: constexpr give wrong result. #11916

Closed

Description

@llcxiongmao

Environment

  • OS and Version: Ubuntu 22.04.3 LTS
  • VS Code Version: 1.85.1
  • C/C++ Extension Version: 1.19.2
  • If using SSH remote, specify OS of remote machine:

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

Activity

  1. browntarik commented on Feb 5, 2024

    @browntarik
    Contributor

    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.

  2. self-assigned this
    on Feb 5, 2024
  3. browntarik commented on Mar 21, 2024

    @browntarik
    Contributor

    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.

  4. added this to the Tracking milestone on Mar 21, 2024
  5. Colengms commented on Oct 20, 2026

    @Colengms
    Contributor

    This appears to have since been addressed. I appear to be getting the correct size now (on Linux, with clang).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions