[PATCH] D103855: [clang] Exclude function pointers on DefaultedComparisonAnalyzer
Richard Smith - zygoloid via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Wed Jun 16 10:45:10 PDT 2021
rsmith added a comment.
I think we need to take this to the C++ committee. For example, consider a case like:
struct A {
using T1 = void(*)();
using T2 = int;
operator T1();
operator T2();
};
struct B {
A a;
friend auto operator<=>(B, B) = default;
};
Under the standard rules, the `operator<=>` is deleted due to ambiguity, but with this change we'd unambiguously pick the conversion to `T2`. The old behavior here better matches the current standard wording -- in particular, the special case is in [class.compare.default]/3.2 and only applies when neither operand is of overloadable type -- but perhaps the right approach here would be to fix the language rules so that `operator<=>` is only provided for object pointer types, not for all pointer types, in general.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D103855/new/
https://reviews.llvm.org/D103855
More information about the cfe-commits
mailing list