rsmith added inline comments.

================
Comment at: clang/test/CXX/class/class.compare/class.spaceship/p2.cpp:200
+  struct b3 {
+    auto operator<=>(b3 const &) const = default; // expected-error {{cannot 
be deduced because three-way comparison for member 'f' would compare as builtin 
type 'void (*)()' which is not currently supported}}
+    // expected-warning@-1 {{implicitly deleted}}
----------------
I think three-way comparison for function pointers is ill-formed, and that the 
problem in this case is that [over.built] lists candidates for which a 
three-way comparison is invalid. So our overload resolution succeeds, but 
results in a meaningless builtin candidate with an undefined return type.

I think the behavior here after this patch is fine -- we should treat the 
comparison as deleted -- but the diagnostic is wrong. This isn't a "not 
currently supported" case, this is a "not a valid expression" case, per 
[class.compare.default]/3.2 (except that the wording currently gets this wrong 
and doesn't actually say what happens here, because we're actually in 
[class.compare.default]/3.1). Though perhaps the better fix would be to not 
even include a builtin candidate for `operator<=>(void (*)(), void (*)())`?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D103850/new/

https://reviews.llvm.org/D103850

_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
  • [PATCH] D103850: ... Matheus Izvekov via Phabricator via cfe-commits
    • [PATCH] D103... Matheus Izvekov via Phabricator via cfe-commits
    • [PATCH] D103... Richard Smith - zygoloid via Phabricator via cfe-commits
    • [PATCH] D103... Matheus Izvekov via Phabricator via cfe-commits

Reply via email to