microsoft / microsoft/vscode-cpptools

IntelliSense fails to convert long double to int

Open
#12,431 5 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug fixed Language Service verified
Dominant language
TypeScript
Stars
6.2k
Forks
1.7k
Avg merge
14h 46m
Merged PRs (30d)
61

Description

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

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the issue in an arbitrary C++ file using const int var = 1.0l;, then compare IntelliSense's displayed value with the double case, const int var = 1.0;. Trace the IntelliSense handling of the long double conversion and verify that the displayed value is 1 while the existing double behavior remains unchanged.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.