[clang] implicitly delete space ship operator with function pointers
authorMatheus Izvekov <mizvekov@gmail.com>
Fri, 26 Feb 2021 23:19:15 +0000 (15:19 -0800)
committerRichard Smith <richard@metafoo.co.uk>
Sat, 27 Feb 2021 00:03:01 +0000 (16:03 -0800)
commit4a8530fc3039f128eddc38737f0172bb3d489bcf
tree9526ae8f11b83e340b9989d3c42f948114309500
parentf685c9ac8647daeb425b05ffb9c555ccfc7ec78b
[clang] implicitly delete space ship operator with function pointers

See bug #48856

Definitions of classes with member function pointers and default
spaceship operator were getting accepted with no diagnostic on
release build, and triggering assert on builds with runtime checks
enabled. Diagnostics were only produced when actually comparing
instances of such classes.

This patch makes it so Spaceship and Less operators are not considered
as builtin operator candidates for function pointers, producing
equivalent diagnostics for the cases where pointers to member function
and pointers to data members are used instead.

Reviewed By: rsmith

Differential Revision: https://reviews.llvm.org/D95409
clang/lib/Sema/SemaDeclCXX.cpp
clang/test/CXX/class/class.compare/class.compare.default/p2.cpp
clang/test/CXX/class/class.compare/class.eq/p2.cpp
clang/test/CXX/class/class.compare/class.spaceship/p2.cpp