summaryrefslogtreecommitdiff
path: root/gcc/cp/lambda.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/cp/lambda.c')
-rw-r--r--gcc/cp/lambda.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/gcc/cp/lambda.c b/gcc/cp/lambda.c
index 2cbad878ff6..4480c67dc5f 100644
--- a/gcc/cp/lambda.c
+++ b/gcc/cp/lambda.c
@@ -245,7 +245,8 @@ lambda_capture_field_type (tree expr, bool explicit_init_p,
{
type = non_reference (unlowered_expr_type (expr));
- if (!is_this && by_reference_p)
+ if (!is_this
+ && (by_reference_p || TREE_CODE (type) == FUNCTION_TYPE))
type = build_reference_type (type);
}