if (Args[0]->getType()->isOverloadableType())
S.LookupOverloadedBinOp(CandidateSet, OO, Fns, Args);
- else {
+ else if (OO == OO_EqualEqual ||
+ !Args[0]->getType()->isFunctionPointerType()) {
// FIXME: We determine whether this is a valid expression by checking to
// see if there's a viable builtin operator candidate for it. That isn't
// really what the rules ask us to do, but should give the right results.
+ //
+ // Note that the builtin operator for relational comparisons on function
+ // pointers is the only known case which cannot be used.
S.AddBuiltinOperatorCandidates(OO, FD->getLocation(), Args, CandidateSet);
}
void(a >= a);
}
+struct A3 {
+ int &x; // expected-note {{because class 'A3' has a reference member}}
+
+ bool operator==(const A3 &) const = default; // expected-warning {{implicitly deleted}}
+ bool operator<(const A3 &) const = default; // expected-warning {{implicitly deleted}}
+ // expected-note@-1 {{because there is no viable comparison function}}
+};
+
struct B1 {
struct {
int x;
struct F { void operator==(F) const; };
struct G { bool operator==(G) const = delete; }; // expected-note {{deleted here}}
+struct H1 {
+ bool operator==(const H1 &) const = default;
+ bool operator<(const H1 &) const = default; // expected-warning {{implicitly deleted}}
+ // expected-note@-1 {{because there is no viable comparison function}}
+ void (*x)();
+};
+struct H2 {
+ bool operator==(const H2 &) const = default;
+ bool operator<(const H2 &) const = default; // expected-warning {{implicitly deleted}}
+ // expected-note@-1 {{because there is no viable comparison function}}
+ void (H2::*x)();
+};
+struct H3 {
+ bool operator==(const H3 &) const = default;
+ bool operator<(const H3 &) const = default; // expected-warning {{implicitly deleted}}
+ // expected-note@-1 {{because there is no viable comparison function}}
+ int H3::*x;
+};
+
template<typename T> struct X {
X();
bool operator==(const X&) const = default; // #x expected-note 4{{deleted here}}
friend CmpCat auto operator<=>(const D&, const D&) = default;
};
}
+
+namespace PR48856 {
+ struct A {
+ auto operator<=>(const A &) const = default; // expected-warning {{implicitly deleted}}
+ void (*x)(); // expected-note {{because there is no viable comparison function for member 'x'}}
+ };
+
+ struct B {
+ auto operator<=>(const B &) const = default; // expected-warning {{implicitly deleted}}
+ void (B::*x)(); // expected-note {{because there is no viable comparison function for member 'x'}}
+ };
+
+ struct C {
+ auto operator<=>(const C &) const = default; // expected-warning {{implicitly deleted}}
+ int C::*x; // expected-note {{because there is no viable comparison function for member 'x'}}
+ };
+}