aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp/lambda.c
diff options
context:
space:
mode:
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);