aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorNathan Sidwell <nathan@acm.org>2016-12-07 13:00:02 +0000
committerNathan Sidwell <nathan@gcc.gnu.org>2016-12-07 13:00:02 +0000
commit098eae0067631ae7a8d98ac19ff47cb89ec2ba25 (patch)
tree4e47e0b0c4fe75f926969153c4c811cc8f77496a /gcc
parentb3235e974fee0ce362afafed93a8e5916ae790e1 (diff)
downloadgcc-098eae0067631ae7a8d98ac19ff47cb89ec2ba25.zip
gcc-098eae0067631ae7a8d98ac19ff47cb89ec2ba25.tar.gz
gcc-098eae0067631ae7a8d98ac19ff47cb89ec2ba25.tar.bz2
pt.c (tsubst <{NON,}TYPE_ARGUMENT_PACK>): Simplify control flow and avoid re-tsubsting type.
* pt.c (tsubst <{NON,}TYPE_ARGUMENT_PACK>: Simplify control flow and avoid re-tsubsting type. From-SVN: r243343
Diffstat (limited to 'gcc')
-rw-r--r--gcc/cp/ChangeLog3
-rw-r--r--gcc/cp/pt.c31
2 files changed, 19 insertions, 15 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index 3964cfd..c666f16 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,5 +1,8 @@
2016-12-07 Nathan Sidwell <nathan@acm.org>
+ * pt.c (tsubst <{NON,}TYPE_ARGUMENT_PACK>: Simplify control flow
+ and avoid re-tsubsting type.
+
* cp-tree.h (enum cp_tree_index): Add CPTI_AUTO_IDENTIFIER &
CPTI_DECLTYPE_AUTO_IDENTIFIER.
(auto_identifier, decltype_auto_identifier): New.
diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c
index 3b80ca4..97d0b48 100644
--- a/gcc/cp/pt.c
+++ b/gcc/cp/pt.c
@@ -13795,22 +13795,23 @@ tsubst (tree t, tree args, tsubst_flags_t complain, tree in_decl)
case TYPE_ARGUMENT_PACK:
case NONTYPE_ARGUMENT_PACK:
{
- tree r = TYPE_P (t) ? cxx_make_type (code) : make_node (code);
- tree packed_out =
- tsubst_template_args (ARGUMENT_PACK_ARGS (t),
- args,
- complain,
- in_decl);
- SET_ARGUMENT_PACK_ARGS (r, packed_out);
-
- /* For template nontype argument packs, also substitute into
- the type. */
- if (code == NONTYPE_ARGUMENT_PACK)
- TREE_TYPE (r) = tsubst (TREE_TYPE (t), args, complain, in_decl);
-
- return r;
+ tree r;
+
+ if (code == NONTYPE_ARGUMENT_PACK)
+ {
+ r = make_node (code);
+ /* Set the already-substituted type. */
+ TREE_TYPE (r) = type;
+ }
+ else
+ r = cxx_make_type (code);
+
+ tree pack_args = ARGUMENT_PACK_ARGS (t);
+ pack_args = tsubst_template_args (pack_args, args, complain, in_decl);
+ SET_ARGUMENT_PACK_ARGS (r, pack_args);
+
+ return r;
}
- break;
case VOID_CST:
case INTEGER_CST: