diff options
author | Jason Merrill <jason@redhat.com> | 2021-05-18 12:29:33 -0400 |
---|---|---|
committer | Jason Merrill <jason@redhat.com> | 2021-05-19 15:43:07 -0400 |
commit | cd67343703ef4fa61de837f4690eba70d2760825 (patch) | |
tree | b704f95df735f0fe15d70ea5e9ff4e529b7ea5f4 /libcpp/include/cpplib.h | |
parent | 9b50282b0dcf79d3141979e466465a23d1816166 (diff) | |
download | gcc-cd67343703ef4fa61de837f4690eba70d2760825.zip gcc-cd67343703ef4fa61de837f4690eba70d2760825.tar.gz gcc-cd67343703ef4fa61de837f4690eba70d2760825.tar.bz2 |
c++: ICE with <=> fallback [PR100367]
Here, when genericizing lexicographical_compare_three_way, we haven't yet
walked the operands, so (a == a) still sees ADDR_EXPR <a>, but this is after
we've changed the type of a to REFERENCE_TYPE. When we try to fold (a == a)
by constexpr evaluation, the constexpr code doesn't understand trying to
take the address of a reference, and we end up crashing.
Fixed by avoiding constexpr evaluation in genericize_spaceship, by using
fold_build2 instead of build_new_op on scalar operands. Class operands
should have been expanded during parsing.
PR c++/100367
PR c++/96299
gcc/cp/ChangeLog:
* method.c (genericize_spaceship): Use fold_build2 for scalar
operands.
gcc/testsuite/ChangeLog:
* g++.dg/cpp2a/spaceship-fallback1.C: New test.
Diffstat (limited to 'libcpp/include/cpplib.h')
0 files changed, 0 insertions, 0 deletions