From 036dc0a0571c61a55286a21e8e9ef58ddd913e73 Mon Sep 17 00:00:00 2001 From: Paolo Carlini Date: Sun, 29 May 2016 08:29:46 +0000 Subject: [PATCH] re PR c++/71105 (lambdas with default captures improperly have function pointer conversions) /cp 2016-05-29 Paolo Carlini PR c++/71105 * lambda.c (maybe_add_lambda_conv_op): Early return also when LAMBDA_EXPR_DEFAULT_CAPTURE_MODE != CPLD_NONE. /testsuite 2016-05-29 Paolo Carlini PR c++/71105 * g++.dg/cpp0x/lambda/lambda-conv11.C: New. * g++.dg/cpp1y/lambda-conv1.C: Likewise. * g++.dg/cpp1y/lambda-conv2.C: Likewise. From-SVN: r236861 --- gcc/cp/ChangeLog | 6 ++++++ gcc/cp/lambda.c | 4 +++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 44022e781e7..b970c6ebae4 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,9 @@ +2016-05-29 Paolo Carlini + + PR c++/71105 + * lambda.c (maybe_add_lambda_conv_op): Early return also when + LAMBDA_EXPR_DEFAULT_CAPTURE_MODE != CPLD_NONE. + 2016-05-28 Ville Voutilainen Revert: diff --git a/gcc/cp/lambda.c b/gcc/cp/lambda.c index 08d6d8205cf..85ad9f895d4 100644 --- a/gcc/cp/lambda.c +++ b/gcc/cp/lambda.c @@ -872,8 +872,10 @@ maybe_add_lambda_conv_op (tree type) bool nested = (cfun != NULL); bool nested_def = decl_function_context (TYPE_MAIN_DECL (type)); tree callop = lambda_function (type); + tree lam = CLASSTYPE_LAMBDA_EXPR (type); - if (LAMBDA_EXPR_CAPTURE_LIST (CLASSTYPE_LAMBDA_EXPR (type)) != NULL_TREE) + if (LAMBDA_EXPR_CAPTURE_LIST (lam) != NULL_TREE + || LAMBDA_EXPR_DEFAULT_CAPTURE_MODE (lam) != CPLD_NONE) return; if (processing_template_decl) -- 2.30.2