Skip to content

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

@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.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions