diff options
Diffstat (limited to 'gcc/cp/method.c')
-rw-r--r-- | gcc/cp/method.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/gcc/cp/method.c b/gcc/cp/method.c index 8e7590c..858655b 100644 --- a/gcc/cp/method.c +++ b/gcc/cp/method.c @@ -1539,10 +1539,15 @@ synthesized_method_walk (tree ctype, special_function_kind sfk, bool const_p, { /* "The closure type associated with a lambda-expression has a deleted default constructor and a deleted copy assignment operator." - This is diagnosed in maybe_explain_implicit_delete. */ + This is diagnosed in maybe_explain_implicit_delete. + In C++2a, only lambda-expressions with lambda-captures have those + deleted. */ if (LAMBDA_TYPE_P (ctype) - && (sfk == sfk_constructor - || sfk == sfk_copy_assignment)) + && (sfk == sfk_constructor || sfk == sfk_copy_assignment) + && (cxx_dialect < cxx2a + || LAMBDA_EXPR_CAPTURE_LIST (CLASSTYPE_LAMBDA_EXPR (ctype)) + || LAMBDA_EXPR_DEFAULT_CAPTURE_MODE + (CLASSTYPE_LAMBDA_EXPR (ctype)) != CPLD_NONE)) { *deleted_p = true; return; |