]> git.ipfire.org Git - thirdparty/gcc.git/commit
c++: ICE when building builtin operator->* set [PR103455]
authorPatrick Palka <ppalka@redhat.com>
Sat, 26 Mar 2022 14:20:16 +0000 (10:20 -0400)
committerPatrick Palka <ppalka@redhat.com>
Wed, 11 May 2022 12:30:29 +0000 (08:30 -0400)
commit3d1c151bc1f4a3231f62dc3af758fb7a19f8f904
treea69e1d1ccf78a6511d39db772e71a7182a7f2972
parent4df77364f7fd9ce88c012843fff124346e4d3c06
c++: ICE when building builtin operator->* set [PR103455]

Here when constructing the builtin operator->* candidate set according
to the available conversion functions for the operand types, we end up
considering a candidate with C1=T (through B's dependent conversion
function) and C2=F, during which we crash from DERIVED_FROM_P because
dependent_type_p sees a TEMPLATE_TYPE_PARM outside of a template
context.

Sidestepping the question of whether we should be considering such a
dependent conversion function here in the first place, it seems futile
to test DERIVED_FROM_P for anything other than an actual class type, so
this patch fixes this ICE by simply guarding the DERIVED_FROM_P test
with CLASS_TYPE_P instead of MAYBE_CLASS_TYPE_P.

PR c++/103455

gcc/cp/ChangeLog:

* call.c (add_builtin_candidate) <case MEMBER_REF>: Test
CLASS_TYPE_P instead of MAYBE_CLASS_TYPE_P.

gcc/testsuite/ChangeLog:

* g++.dg/overload/builtin6.C: New test.

(cherry picked from commit 04f19580e8dbdbc7366d0f5fd068aa0cecafdc9d)
gcc/cp/call.c
gcc/testsuite/g++.dg/overload/builtin6.C [new file with mode: 0644]