aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp/lambda.c
diff options
context:
space:
mode:
authorJason Merrill <jason@redhat.com>2016-07-25 15:16:16 -0400
committerJason Merrill <jason@gcc.gnu.org>2016-07-25 15:16:16 -0400
commit47265942fa55c8198ef712af8ee23c4700ca2dfb (patch)
tree3cfaeafad0fb02b4fdef81de985517f29e064e9c /gcc/cp/lambda.c
parente27f0bc9ca3e9d9266eb299ee6a27daef5c1e0b6 (diff)
downloadgcc-47265942fa55c8198ef712af8ee23c4700ca2dfb.zip
gcc-47265942fa55c8198ef712af8ee23c4700ca2dfb.tar.gz
gcc-47265942fa55c8198ef712af8ee23c4700ca2dfb.tar.bz2
PR c++/71837 - pack expansion in init-capture
* lambda.c (add_capture): Leave a pack expansion in a TREE_LIST. (build_lambda_object): Call build_x_compound_expr_from_list. * pt.c (tsubst) [DECLTYPE_TYPE]: Likewise. From-SVN: r238733
Diffstat (limited to 'gcc/cp/lambda.c')
-rw-r--r--gcc/cp/lambda.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/gcc/cp/lambda.c b/gcc/cp/lambda.c
index 4d6d80f..9bf8a56 100644
--- a/gcc/cp/lambda.c
+++ b/gcc/cp/lambda.c
@@ -79,6 +79,10 @@ build_lambda_object (tree lambda_expr)
goto out;
}
+ if (TREE_CODE (val) == TREE_LIST)
+ val = build_x_compound_expr_from_list (val, ELK_INIT,
+ tf_warning_or_error);
+
if (DECL_P (val))
mark_used (val);
@@ -449,7 +453,9 @@ add_capture (tree lambda, tree id, tree orig_init, bool by_reference_p,
variadic = true;
}
- if (TREE_CODE (initializer) == TREE_LIST)
+ if (TREE_CODE (initializer) == TREE_LIST
+ /* A pack expansion might end up with multiple elements. */
+ && !PACK_EXPANSION_P (TREE_VALUE (initializer)))
initializer = build_x_compound_expr_from_list (initializer, ELK_INIT,
tf_warning_or_error);
type = TREE_TYPE (initializer);