@@ -238,11 +238,11 @@ cp_common_init_ts (void)
MARK_TS_COMMON (TYPEOF_TYPE);
MARK_TS_COMMON (BASELINK);
MARK_TS_COMMON (TYPE_PACK_EXPANSION);
- MARK_TS_COMMON (EXPR_PACK_EXPANSION);
MARK_TS_COMMON (DECLTYPE_TYPE);
MARK_TS_COMMON (BOUND_TEMPLATE_TEMPLATE_PARM);
MARK_TS_COMMON (UNBOUND_CLASS_TEMPLATE);
+ MARK_TS_TYPED (EXPR_PACK_EXPANSION);
MARK_TS_TYPED (SWITCH_STMT);
MARK_TS_TYPED (IF_STMT);
MARK_TS_TYPED (FOR_STMT);
@@ -413,7 +413,7 @@ DEFTREECODE (TYPE_PACK_EXPANSION, "type_pack_expansion", tcc_type, 0)
EXPR_PACK_EXPANSION plays precisely the same role as TYPE_PACK_EXPANSION,
but will be used for expressions. */
-DEFTREECODE (EXPR_PACK_EXPANSION, "expr_pack_expansion", tcc_expression, 1)
+DEFTREECODE (EXPR_PACK_EXPANSION, "expr_pack_expansion", tcc_expression, 2)
/* Selects the Ith parameter out of an argument pack. This node will
be used when instantiating pack expansions; see
@@ -2713,7 +2713,10 @@ extern void decl_shadowed_for_var_insert (tree, tree);
/* The list of parameter packs used in the PACK_EXPANSION_* node. The
TREE_VALUE of each TREE_LIST contains the parameter packs. */
-#define PACK_EXPANSION_PARAMETER_PACKS(NODE) TREE_CHAIN (NODE)
+#define PACK_EXPANSION_PARAMETER_PACKS(NODE) \
+ *(TREE_CODE (NODE) == EXPR_PACK_EXPANSION \
+ ? &TREE_OPERAND (NODE, 1) \
+ : &TREE_CHAIN (TYPE_PACK_EXPANSION_CHECK (NODE)))
/* Determine if this is an argument pack. */
#define ARGUMENT_PACK_P(NODE) \
@@ -2653,6 +2653,10 @@ write_expression (tree expr)
len = 2;
break;
+ case EXPR_PACK_EXPANSION:
+ len = 1;
+ break;
+
default:
len = TREE_OPERAND_LENGTH (expr);
break;