Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IntelliSense wrongly underlined error if Explicit Object Parameter, Type Conversion Operator, and Template are used together. #13061

Open
bionukg opened this issue Dec 15, 2024 · 2 comments
Labels
bug Language Service Visual Studio Inherited from Visual Studio
Milestone

Comments

@bionukg
Copy link

bionukg commented Dec 15, 2024

Environment

  • OS and Version: Windows_NT x64 10.0.19045
  • VS Code Version: 1.96.0
  • C/C++ Extension Version: 1.22.11, updated at 2024-11-06, 19:45:17
  • If using SSH remote, specify OS of remote machine: none

Bug Summary and Steps to Reproduce

Bug Summary:
IntelliSense error if Explicit Object Parameter, Type Conversion Operator, and Template are used together.

Steps to reproduce:

  1. create a new file named 'bug.cpp' (use cppStandard c++23).
  2. copy the code below into it:
struct A
{
    template <typename T>
    operator int(this T & self) { return 1; }
    operator char(this auto &self) { return 2; }
};

int main()
{
    A a;
    int i = a;
    int j = int(a);
    char k = char(a);
    return i;
}
  1. some codes are red underlined.

Expected behavior:
there should be no red underlined code.

Configuration and Logs

-------- Diagnostics - 2024/12/15 22:08:22
Version: 1.22.11
Current Configuration:
{
    "name": "Win32",
    "includePath": [
        "${workspaceFolder}/**"
    ],
    "defines": [
        "_DEBUG",
        "UNICODE",
        "_UNICODE"
    ],
    "windowsSdkVersion": "10.0.26100.0",
    "compilerPath": "cl.exe",
    "cStandard": "c17",
    "intelliSenseMode": "windows-msvc-x64",
    "compilerPathInCppPropertiesJson": "cl.exe",
    "cppStandard": "c++23",
    "intelliSenseModeIsExplicit": false,
    "cStandardIsExplicit": false,
    "cppStandardIsExplicit": true,
    "mergeConfigurations": false,
    "compilerPathIsExplicit": false,
    "browse": {
        "path": [
            "${workspaceFolder}/**"
        ],
        "limitSymbolsToIncludedHeaders": true
    }
}
Modified Settings:
{
    "C_Cpp.inlayHints.autoDeclarationTypes.enabled": true,
    "C_Cpp.inlayHints.parameterNames.enabled": true,
    "C_Cpp.default.cppStandard": "c++23"
}
Additional Tracked Settings:
{
    "editorTabSize": 4,
    "editorInsertSpaces": true,
    "editorAutoClosingBrackets": "languageDefined",
    "filesEncoding": "utf8",
    "filesAssociations": {
        "*.vt": "verilog",
        "*.ixx": "cpp",
        "*.asm": "masm"
    },
    "filesExclude": {
        "**/.git": true,
        "**/.svn": true,
        "**/.hg": true,
        "**/CVS": true,
        "**/.DS_Store": true,
        "**/Thumbs.db": true
    },
    "filesAutoSaveAfterDelay": true,
    "editorInlayHintsEnabled": true,
    "editorParameterHintsEnabled": true,
    "searchExclude": {
        "**/node_modules": true,
        "**/bower_components": true,
        "**/*.code-search": true
    },
    "workbenchSettingsEditor": "ui"
}
cpptools version (native): 1.22.11.0
Current database path: C:\USERS\BIONUKG\APPDATA\LOCAL\TEMP\{0034E163-EF00-48B0-8732-7DB74FF7DE52}\.BROWSE.VC.DB
Translation Unit Mappings:
[ C:\Users\bionukg\Desktop\bug\bug.cpp - source TU]:
Translation Unit Configurations:
[ C:\Users\bionukg\Desktop\bug\bug.cpp ]
    Process ID: 15812
    Memory Usage: 51 MB
    Compiler Path: C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.42.34433\bin\Hostx64\x64\cl.exe
    Includes:
    System Includes:
        C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.42.34433\include
        C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.42.34433\atlmfc\include
        C:\Program Files (x86)\Windows Kits\10\Include\10.0.26100.0\um
        C:\Program Files (x86)\Windows Kits\10\Include\10.0.26100.0\ucrt
        C:\Program Files (x86)\Windows Kits\10\Include\10.0.26100.0\shared
        C:\Program Files (x86)\Windows Kits\10\Include\10.0.26100.0\winrt
        C:\Program Files (x86)\Windows Kits\10\Include\10.0.26100.0\cppwinrt
    Defines:
        _DEBUG
        UNICODE
        _UNICODE
    Standard Version: ms_c++latest
    IntelliSense Mode: windows-msvc-x64
Total Memory Usage: 51 MB

Other Extensions

No response

Additional context

Image

@sean-mcmanus sean-mcmanus added bug Language Service Visual Studio Inherited from Visual Studio labels Dec 16, 2024
@sean-mcmanus sean-mcmanus added this to the Tracking milestone Dec 16, 2024
@sean-mcmanus
Copy link
Contributor

@bionukg I've reported a bug on our shared VS parser at https://developercommunity.visualstudio.com/t/C-IntelliSense-error-with-C23-explic/10813897 .

@Vaibhav75058
Copy link

i am aslo facing the same isssue after installing c/c++ intellisense extention showing red error line under the # of include file
#include
using namespace std;
int main()

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Language Service Visual Studio Inherited from Visual Studio
Projects
Status: No status
Development

No branches or pull requests

3 participants