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

_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to