Skip to content

[clang] operator<=> generated too early #106847

@kelbon

Description

@kelbon
#include <vector>

struct X;

struct Y {
    std::vector<X> x;
    std::strong_ordering operator<=>(const Y& r) const = default;
};

struct X {
    int i;

    std::strong_ordering operator<=>(const X& r) const = default;
};


int main(){
    Y y;
    // error: object of type 'Y' cannot be compared because its 'operator<=>' is implicitly deleted
    (void)(y <=> y);
}

https://godbolt.org/z/PP1as95Ks

Metadata

Metadata

Assignees

No one assigned

    Labels

    clang:frontendLanguage frontend issues, e.g. anything involving "Sema"diverges-from:gccDoes the clang frontend diverge from gcc on this issuespaceshipissues related to <=>

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions