re PR c++/71105 (lambdas with default captures improperly have function pointer conve...
authorPaolo Carlini <paolo.carlini@oracle.com>
Sun, 29 May 2016 08:29:46 +0000 (08:29 +0000)
committerPaolo Carlini <paolo@gcc.gnu.org>
Sun, 29 May 2016 08:29:46 +0000 (08:29 +0000)
/cp
2016-05-29  Paolo Carlini  <paolo.carlini@oracle.com>

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  <paolo.carlini@oracle.com>

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
gcc/cp/lambda.c

index 44022e781e790180ccaaf97207651bfe3a7d5ae9..b970c6ebae4c5704cf6d7c0267dc825ac19001ee 100644 (file)
@@ -1,3 +1,9 @@
+2016-05-29  Paolo Carlini  <paolo.carlini@oracle.com>
+
+       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  <ville.voutilainen@gmail.com>
 
        Revert:
index 08d6d8205cf0d76a182cb359b3110e3533fb2ebf..85ad9f895d48743e123f8629c2c5a1138f205097 100644 (file)
@@ -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)