From: Egas Ribeiro Date: Mon, 8 Dec 2025 18:04:42 +0000 (+0000) Subject: c++: Document why TARGET_EXPR is not handled in tsubst_expr X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=24efdb0974e19f9c31731dc0d8bdf52044705b50;p=thirdparty%2Fgcc.git c++: Document why TARGET_EXPR is not handled in tsubst_expr 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. Signed-off-by: Egas Ribeiro Reviewed-by: Patrick Palka --- diff --git a/gcc/cp/pt.cc b/gcc/cp/pt.cc index a9b311be9ac..ce30b527663 100644 --- a/gcc/cp/pt.cc +++ b/gcc/cp/pt.cc @@ -22562,6 +22562,11 @@ tsubst_expr (tree t, tree args, tsubst_flags_t complain, tree in_decl) in response to the saved STMT_IS_FULL_EXPR_P setting. */ gcc_unreachable (); + case TARGET_EXPR: + /* TARGET_EXPR represents temporary objects and should not appear in + templated trees. */ + gcc_unreachable (); + case OFFSET_REF: { /* We should only get here for an OFFSET_REF like A::m; a .* in a