Skip to content

Commit 80ddcb9

Browse files
author
Patrick Palka
committed
objc++: type/expr tsubst conflation [PR111920]
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.
1 parent 47b634a commit 80ddcb9

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed

gcc/cp/pt.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20261,7 +20261,7 @@ tsubst_expr (tree t, tree args, tsubst_flags_t complain, tree in_decl)
2026120261
op1 = TREE_OPERAND (t, 0);
2026220262
++cp_unevaluated_operand;
2026320263
++c_inhibit_evaluation_warnings;
20264-
op1 = tsubst_expr (op1, args, complain, in_decl);
20264+
op1 = tsubst (op1, args, complain, in_decl);
2026520265
--cp_unevaluated_operand;
2026620266
--c_inhibit_evaluation_warnings;
2026720267
RETURN (objc_build_encode_expr (op1));

gcc/objcp/objcp-lang.cc

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,8 +66,14 @@ objcp_tsubst_expr (tree t, tree args, tsubst_flags_t complain, tree in_decl)
6666
RECURSE (TREE_OPERAND (t, 2)), NULL);
6767

6868
case CLASS_REFERENCE_EXPR:
69-
return objc_get_class_reference
70-
(RECURSE (TREE_OPERAND (t, 0)));
69+
{
70+
tree ident = TREE_OPERAND (t, 0);
71+
if (TYPE_P (ident))
72+
ident = tsubst (ident, args, complain, in_decl);
73+
else
74+
ident = RECURSE (ident);
75+
return objc_get_class_reference (ident);
76+
}
7177

7278
default:
7379
break;

0 commit comments

Comments
 (0)