On Sun, 30 Nov 2025, Egas Ribeiro wrote: > TARGET_EXPR represents semantic temporary objects and is deliberately > not handled by tsubst routines, which expect syntactic templated trees. > Add a comment and gcc_unreachable to make this explicit. > > gcc/cp/ChangeLog: > > * pt.cc (tsubst_expr): Add TARGET_EXPR case with explanatory > comment and gcc_unreachable. > --- > gcc/cp/pt.cc | 4 ++++ > 1 file changed, 4 insertions(+) > > diff --git a/gcc/cp/pt.cc b/gcc/cp/pt.cc > index 4dc8f980d0d..19729cfe13d 100644 > --- a/gcc/cp/pt.cc > +++ b/gcc/cp/pt.cc > @@ -22300,6 +22300,10 @@ tsubst_expr (tree t, tree args, tsubst_flags_t > complain, tree in_decl) > RETURN (build_typeid (operand_0, complain)); > } > } > + case TARGET_EXPR: > + /* TARGET_EXPR represents temporary objects and should not appear in > + templated trees. (PR c++/117034) */ > + gcc_unreachable ();
Could you move this case to after the CLEANUP_POINT_EXPR case (another non-templated tree)? While you're at it I think we should remove the PR mention since this is a general design decision, and doesn't actually fix that PR. And don't forget the Signed-off-by tag if it's applicable to you :) > > case FUNCTION_DECL: > case PARM_DECL: > -- > 2.52.0 > >
