]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
objc++: type/expr tsubst conflation [PR111920]
authorPatrick Palka <ppalka@redhat.com>
Sun, 22 Oct 2023 20:13:33 +0000 (16:13 -0400)
committerPatrick Palka <ppalka@redhat.com>
Sun, 22 Oct 2023 20:13:33 +0000 (16:13 -0400)
After r14-4796-g3e3d73ed5e85e7, tsubst_copy_and_build (now named
tsubst_expr) no longer dispatches to tsubst for type trees, and
callers have to do it themselves if appropriate.  This patch makes
some overlooked adjustments to Objective-C++-specific code paths.

PR objc++/111920

gcc/cp/ChangeLog:

* pt.cc (tsubst_expr) <case AT_ENCODE_EXPR>: Use tsubst instead
of tsubst_expr.

gcc/objcp/ChangeLog:

* objcp-lang.cc (objcp_tsubst_expr) <case CLASS_REFERENCE_EXPR>:
Use tsubst instead of tsubst_expr for type operands.

gcc/cp/pt.cc
gcc/objcp/objcp-lang.cc

index 210c6cb9e4d33cc973358df25c9eb2f66828c684..1c1c93131180c41bfb97b87f15c8413bb271787a 100644 (file)
@@ -20261,7 +20261,7 @@ tsubst_expr (tree t, tree args, tsubst_flags_t complain, tree in_decl)
        op1 = TREE_OPERAND (t, 0);
        ++cp_unevaluated_operand;
        ++c_inhibit_evaluation_warnings;
-       op1 = tsubst_expr (op1, args, complain, in_decl);
+       op1 = tsubst (op1, args, complain, in_decl);
        --cp_unevaluated_operand;
        --c_inhibit_evaluation_warnings;
        RETURN (objc_build_encode_expr (op1));
index 5b04cd66290fea2c0338fb05a9cd71b6986fbb5a..ee39aece84844ae07350f93a413c85f12e370f35 100644 (file)
@@ -66,8 +66,14 @@ objcp_tsubst_expr (tree t, tree args, tsubst_flags_t complain, tree in_decl)
         RECURSE (TREE_OPERAND (t, 2)), NULL);
 
     case CLASS_REFERENCE_EXPR:
-      return objc_get_class_reference
-       (RECURSE (TREE_OPERAND (t, 0)));
+      {
+       tree ident = TREE_OPERAND (t, 0);
+       if (TYPE_P (ident))
+         ident = tsubst (ident, args, complain, in_decl);
+       else
+         ident = RECURSE (ident);
+       return objc_get_class_reference (ident);
+      }
 
     default:
       break;