c++: ICE with template NEW_EXPR [PR105803]
commit7b98910406b5000a6429c188b0c6cc14e3140637
authorMarek Polacek <polacek@redhat.com>
Wed, 1 Jun 2022 22:21:36 +0000 (1 18:21 -0400)
committerMarek Polacek <polacek@redhat.com>
Thu, 2 Jun 2022 20:00:45 +0000 (2 16:00 -0400)
treebaf37f3ba94578ed94daa786af38ec9ce83892b6
parent6cf276ddf22066af780335cd0072d2c27aabe468
c++: ICE with template NEW_EXPR [PR105803]

Here we ICE because value_dependent_expression_p gets a NEW_EXPR
whose operand is a type, and we go to the default case which just
calls v_d_e_p on each operand of the NEW_EXPR.  Since one of them
is a type, we crash on the new assert in t_d_e_p.

t_d_e_p has code to handle {,VEC_}NEW_EXPR, which at this point
was already performed, so I think we can handle these two codes
specifically and skip the second operand, which is always going
to be a type.

PR c++/105803

gcc/cp/ChangeLog:

* pt.cc (value_dependent_expression_p): Handle {,VEC_}NEW_EXPR
in the switch.

gcc/testsuite/ChangeLog:

* g++.dg/template/new13.C: New test.
gcc/cp/pt.cc
gcc/testsuite/g++.dg/template/new13.C [new file with mode: 0644]