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

Incorrect diagnostic for operator <=> #9215

Closed
Koishilll opened this issue Apr 21, 2022 · 4 comments
Closed

Incorrect diagnostic for operator <=> #9215

Koishilll opened this issue Apr 21, 2022 · 4 comments
Labels
bug fixed Check the Milestone for the release in which the fix is or will be available. Language Service verified Bug has been reproduced Visual Studio Inherited from Visual Studio
Milestone

Comments

@Koishilll
Copy link

Bug type: Language Service

Describe the bug

  • OS and Version: Windows 11, Build 22598.ni_release.220408-1503
  • VS Code Version: 1.66.2 (system setup)
  • C/C++ Extension Version: 1.9.7
  • Other extensions you installed (and if the issue persists after disabling them): all deactivated, issue persists
  • Compiler Version: MSVC 19.31.31106.2

Steps to reproduce

  1. Open "Developer PowerShell for VS 2022" and run "code"
  2. Open a folder with file "./wrap.cpp", "./.vscode/c_cpp_properties.json" (offered below)
  3. See incorrect diagnostic
more than one operator "<=>" matches these operands:C/C++(350)
wrap.cpp(17, 17): function template "auto wrap<T>::operator<=>(const wrap<U> &other) [with T=float]" (declared at line 8), with reversed arguments
wrap.cpp(17, 17): function template "auto wrap<T>::operator<=>(const wrap<U> &other) [with T=double]" (declared at line 8)
wrap.cpp(17, 17): operand types are: wrap<double> <=> wrap<float>

+2 similar diagnostic

  1. The code can compile with no diagnostic
cl wrap.cpp /std:c++latest /EHsc /permissive- /W4 /nologo

Expected behavior

No issue any diagnostic

Code sample and logs

  • Code sample: wrap.cpp
#include <iostream>

template <typename T>
struct wrap {
    T data;

    template <typename U>
    auto operator<=>(const wrap<U> &other) {
        return data <=> other.data;
    }
};

int main() {
    using std::cout, std::endl;
    wrap<double> a { 1.0 };
    wrap<float> b { 2.0f };
    cout << ((a <=> b) <  0) << endl;
    cout << ((a <=> b) == 0) << endl;
    cout << ((a <=> b) >  0) << endl;
}
  • Configurations in c_cpp_properties.json
{
    "configurations": [
        {
            "name": "Win32",
            "includePath": [
                "${workspaceFolder}/**"
            ],
            "defines": [
                "_DEBUG",
                "UNICODE",
                "_UNICODE"
            ],
            "windowsSdkVersion": "10.0.19041.0",
            "compilerPath": "C:/Program Files/Microsoft Visual Studio/2022/Community/VC/Tools/MSVC/14.31.31103/bin/Hostx64/x64/cl.exe",
            "cStandard": "c17",
            "cppStandard": "c++20",
            "intelliSenseMode": "windows-msvc-x64"
        }
    ],
    "version": 4
}
@michelleangela michelleangela added bug Language Service verified Bug has been reproduced Works in VS So we'd need to fix it for VS Code to reach parity. labels Apr 21, 2022
@michelleangela michelleangela added this to the 1.11.0 milestone Apr 21, 2022
@sean-mcmanus
Copy link
Contributor

sean-mcmanus commented May 21, 2022

@michelleangela I repro the issue with VS -- were you going to file a bug on them, either externally or internally? It a C++20 or C++23 issue so I'm thinking it'll be high priority for them to fix.

image

@sean-mcmanus
Copy link
Contributor

@michelleangela You may not have reproed it earlier in VS, because they had a bug which was causing squiggles to disappear, which got fixed recently.

@sean-mcmanus sean-mcmanus removed the Works in VS So we'd need to fix it for VS Code to reach parity. label May 21, 2022
@michelleangela
Copy link
Contributor

@michelleangela michelleangela added the Visual Studio Inherited from Visual Studio label May 23, 2022
@bobbrow bobbrow modified the milestones: 1.11, Tracking Jun 9, 2022
@sean-mcmanus sean-mcmanus modified the milestones: Tracking, 1.12.1 Aug 2, 2022
@sean-mcmanus sean-mcmanus added the fixed Check the Milestone for the release in which the fix is or will be available. label Aug 2, 2022
@sean-mcmanus
Copy link
Contributor

@github-actions github-actions bot locked and limited conversation to collaborators Oct 15, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug fixed Check the Milestone for the release in which the fix is or will be available. Language Service verified Bug has been reproduced Visual Studio Inherited from Visual Studio
Projects
None yet
Development

No branches or pull requests

4 participants