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 <[email protected]>
---
 gcc/cp/pt.cc | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/gcc/cp/pt.cc b/gcc/cp/pt.cc
index 7a019d33bda..339519bbb51 100644
--- a/gcc/cp/pt.cc
+++ b/gcc/cp/pt.cc
@@ -22561,6 +22561,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
-- 
2.52.0

Reply via email to