c++: ICE with defaulted comparison operator [PR94478]
authorMarek Polacek <polacek@redhat.com>
Tue, 7 Apr 2020 18:24:52 +0000 (14:24 -0400)
committerMarek Polacek <polacek@redhat.com>
Wed, 8 Apr 2020 12:56:07 +0000 (08:56 -0400)
commita6479aa4c0532ee9ad1f098b4e82de9dc684e036
tree27a48b54e66d8f29800f434fa5a11010af19cb79
parent542f73539db1433303a4dd16bd2cfc5e7e12eda8
c++: ICE with defaulted comparison operator [PR94478]

Here we ICE because early_check_defaulted_comparison passed a null
ctx to same_type_p.  The attached test is ill-formed according to
[class.compare.default]/1, so fixed by detecting this case early.

PR c++/94478 - ICE with defaulted comparison operator
* method.c (early_check_defaulted_comparison): Give an error when the
context is null.

* g++.dg/cpp2a/spaceship-err4.C: New test.
gcc/cp/ChangeLog
gcc/cp/method.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/cpp2a/spaceship-err4.C [new file with mode: 0644]