vscode-cpptools icon indicating copy to clipboard operation
vscode-cpptools copied to clipboard

IntelliSense fails to convert long double to int

Open GoodCoder666 opened this issue 1 year ago • 5 comments

Environment

  • OS and Version: Windows 11 23H2
  • VS Code Version: 1.90.2
  • C/C++ Extension Version: v1.20.5
  • If using SSH remote, specify OS of remote machine: WSL ubuntu

Bug Summary and Steps to Reproduce

Bug Summary:

image

Steps to reproduce:

  1. Create arbitrary cpp file
  2. Type const int var = 1.0l;
  3. Put the cursor on var
  4. Shows const int var = 0

Expected behavior: Show const int var = 1

This is fine when using a double, e.g. const int var = 1.0;

Configuration and Logs

-------- Diagnostics - 7/3/2024, 11:17:59 AM
Version: 1.20.5
Current Configuration:
{
    "name": "Linux",
    "includePath": [
        "/home/stanley/Code/**"
    ],
    "defines": [],
    "compilerPath": "/usr/bin/gcc",
    "cStandard": "c17",
    "cppStandard": "gnu++17",
    "intelliSenseMode": "linux-gcc-x64",
    "compilerPathInCppPropertiesJson": "/usr/bin/gcc",
    "intelliSenseModeIsExplicit": false,
    "cStandardIsExplicit": false,
    "cppStandardIsExplicit": false,
    "mergeConfigurations": false,
    "compilerPathIsExplicit": false,
    "browse": {
        "path": [
            "/home/stanley/Code/**",
            "${workspaceFolder}"
        ],
        "limitSymbolsToIncludedHeaders": true
    }
}
cpptools version (native): 1.20.5.0
Translation Unit Mappings:
[ /home/stanley/Code/test.cpp - source TU]:
[ /tmp/temp.cpp - source TU]:
Translation Unit Configurations:
[ /home/stanley/Code/test.cpp ]:
    Process ID: 4915
    Memory Usage: 17 MB
    Compiler Path: /usr/bin/gcc
    Includes:
        /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
[ /tmp/temp.cpp ]:
    Process ID: 4976
    Memory Usage: 15 MB
    Compiler Path: /usr/bin/gcc
    Includes:
        /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: 32 MB

------- Workspace parsing diagnostics -------
Number of files discovered (not excluded): 5620
Number of files parsed: 1

Other Extensions

No response

Additional context

No response

GoodCoder666 avatar Jul 03 '24 03:07 GoodCoder666

How is the work going? The issue persists in the latest version.

GoodCoder666 avatar Sep 08 '24 04:09 GoodCoder666

@GoodCoder666 I just tested it with exact example you gave and hover tip shows correctly that var = 1.

FilipNur avatar Sep 13 '24 15:09 FilipNur

@zix527 I believe the issue only repros on Linux/Mac and not Windows (or some subset of OS platforms).

sean-mcmanus avatar Sep 13 '24 16:09 sean-mcmanus

@FilipNur @sean-mcmanus It indeed works fine on Windows. So what's the reason for this 🤔

GoodCoder666 avatar Sep 21 '24 10:09 GoodCoder666

This is fixed with 1.26.1, but it introduced another bug with long double literals: https://github.com/microsoft/vscode-cpptools/issues/13674 (I've confirmed that reverting this fix fixes the other issue).

sean-mcmanus avatar Jun 05 '25 22:06 sean-mcmanus