c++: Fix ICE on defaulted spaceship with pointer return type [PR94162]
authorJakub Jelinek <jakub@redhat.com>
Thu, 12 Aug 2021 07:16:13 +0000 (09:16 +0200)
committerJakub Jelinek <jakub@redhat.com>
Thu, 12 Aug 2021 07:34:16 +0000 (09:34 +0200)
commit9b7ab853bf33106fd0539e36d6ce7730269026e1
treecd246195e79ecfddde3abe1930acea5e5083e592
parentc84f79e9e3f63e9ae447fd15dbd0a768cab3f643
c++: Fix ICE on defaulted spaceship with pointer return type [PR94162]

The spaceship-synth-neg6.C testcase ICEs because we call cat_tag_for
on the explicit return type, but pointer types don't have
TYPE_LINKAGE_IDENTIFIER.  The patch fixes that by checking for
CLASS_TYPE_P only and also adds verification that it is in std
namespace, so we don't return non-cc_last for my_namespace::partial_ordering.

The g++.dg/cpp2a/spaceship-synth11.C testcase is from a PR that has been
fixed with r12-619-gfc178519771db508c03611cff4a1466cf67fce1d (but
not backported to 11).

2021-08-12  Jakub Jelinek  <jakub@redhat.com>

gcc/cp/
PR c++/94162
* method.c (cat_tag_for): Return cc_last for !CLASS_TYPE_P
or for classes not in std namespace.
gcc/testsuite/
PR c++/99429
* g++.dg/cpp2a/spaceship-synth11.C: New test.

PR c++/94162
* g++.dg/cpp2a/spaceship-synth-neg6.C: New test.
gcc/cp/method.c
gcc/testsuite/g++.dg/cpp2a/spaceship-synth-neg6.C [new file with mode: 0644]
gcc/testsuite/g++.dg/cpp2a/spaceship-synth11.C [new file with mode: 0644]