[Bug c++/96533] ICE with -Wunused-parameter when using three-way comparison
natattak at gmail dot com
gcc-bugzilla@gcc.gnu.org
Sun Aug 9 15:16:03 GMT 2020
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96533
--- Comment #1 from Nathaniel Shead <natattak at gmail dot com> ---
On further investigation, I suspect this is more general than just
`-Wunused-parameter`; the error looks to be caused by any error occurring
within `operator<`. For example,
#include <compare>
#include <functional>
struct S {};
auto operator<=>(S, S) = default;
template <typename Lhs, typename Rhs>
auto operator<(Lhs&&, Rhs&& rhs) {
return rhs.nonexistent;
}
int main() {
return std::less{}(S{}, S{});
}
produces the same issue.
I also discovered that the issue is only when the templated `operator<` has
deduced type.
More information about the Gcc-bugs
mailing list