Skip to content

False positive clangd(unused-includes) with deduced return operator<=> #130753

Open
@Eisenwave

Description

@Eisenwave

The following code raises clang(implied_comparison_category_type_not_found):

struct awoo {
    friend auto operator<=>(awoo,awoo) = default;
};

The following code then raises: clangd(unused-includes):

#include <compare>
struct awoo {
    friend auto operator<=>(awoo,awoo) = default;
};

Not sure how to reproduce on Compiler Explorer.

To fix it, one must use std::strong_ordering instead of auto.

Activity

llvmbot

llvmbot commented on Mar 11, 2025

@llvmbot
Member

@llvm/issue-subscribers-clang-include-cleaner

Author: Jan Schultke (Eisenwave)

The following code raises `clang(implied_comparison_category_type_not_found)`: ```cpp struct awoo { friend auto operator<=>(awoo,awoo) = default; }; ``` The following code then raises: `clangd(unused-includes)`: ```cpp #include <compare> struct awoo { friend auto operator<=>(awoo,awoo) = default; }; ``` Not sure how to reproduce on Compiler Explorer.

To fix it, one must use std::strong_ordering instead of auto.

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @Eisenwave@frederick-vs-ja@llvmbot

        Issue actions

          False positive `clangd(unused-includes)` with deduced return `operator<=>` · Issue #130753 · llvm/llvm-project