https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96745
--- Comment #6 from CVS Commits <cvs-commit at gcc dot gnu.org> --- The master branch has been updated by Patrick Palka <ppa...@gcc.gnu.org>: https://gcc.gnu.org/g:ed2b519e02eac99fadfa51adc7b11f8854c24575 commit r13-5683-ged2b519e02eac99fadfa51adc7b11f8854c24575 Author: Patrick Palka <ppa...@redhat.com> Date: Fri Feb 3 09:15:29 2023 -0500 c++: ICE on unviable/ambiguous constrained dtors [PR96745] Here we're crashing from check_bases_and_members due to CLASSTYPE_DESTRUCTOR being an OVERLOAD which, due to the pruning performed by add_method, should only happen if there is no viable destructor or the destructor is ambiguous because of unsatisfied or ambiguous constraints. This patch fixes this by making check_bases_and_members naturally handle CLASSTYPE_DESTRUCTOR being an OVERLOAD. It's then convenient to prune the OVERLOAD after effectively diagnosing the overload resolution failure in check_methods. PR c++/96745 gcc/cp/ChangeLog: * class.cc (check_methods): Diagnose an unviable OVERLOAD set for CLASSTYPE_DESTRUCTOR differently from an ambiguous one. Then prune the OVERLOAD to a single function. (check_bases_and_members): Handle CLASSTYPE_DESTRUCTOR being an OVERLOAD when calling deduce_noexcept_on_destructor. Document why it has to be called before check_methods. gcc/testsuite/ChangeLog: * g++.dg/cpp2a/concepts-dtor1.C: New test.