summaryrefslogtreecommitdiffstats
path: root/clang/lib/AST/DeclCXX.cpp
diff options
context:
space:
mode:
authorDavid Blaikie <dblaikie@gmail.com>2019-07-08 23:24:41 +0000
committerDavid Blaikie <dblaikie@gmail.com>2019-07-08 23:24:41 +0000
commit793231c319f05c476071f0aad5104219be9185f8 (patch)
treecddd2cb23eee9dbda55bac6743d6361ba0d45f70 /clang/lib/AST/DeclCXX.cpp
parent315ce839be27d66727c6eef9f211de424180b728 (diff)
downloadbcm5719-llvm-793231c319f05c476071f0aad5104219be9185f8.tar.gz
bcm5719-llvm-793231c319f05c476071f0aad5104219be9185f8.zip
[cxx2a] P0624R2 fix: only lambdas with no lambda-capture are default-constructible and assignable.
This is a fix for rG864949 which only disabled default construction and assignment for lambdas with capture-defaults, where the C++2a draft disables them for lambdas with any lambda-capture at all. Patch by Logan Smith! Differential Revision: https://reviews.llvm.org/D64058 llvm-svn: 365406
Diffstat (limited to 'clang/lib/AST/DeclCXX.cpp')
-rw-r--r--clang/lib/AST/DeclCXX.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/clang/lib/AST/DeclCXX.cpp b/clang/lib/AST/DeclCXX.cpp
index a5793ce3aad..857ac19e6b1 100644
--- a/clang/lib/AST/DeclCXX.cpp
+++ b/clang/lib/AST/DeclCXX.cpp
@@ -645,7 +645,8 @@ bool CXXRecordDecl::lambdaIsDefaultConstructibleAndAssignable() const {
// C++17 [expr.prim.lambda]p21:
// The closure type associated with a lambda-expression has no default
// constructor and a deleted copy assignment operator.
- if (getLambdaCaptureDefault() != LCD_None)
+ if (getLambdaCaptureDefault() != LCD_None ||
+ getLambdaData().NumCaptures != 0)
return false;
return getASTContext().getLangOpts().CPlusPlus2a;
}
OpenPOWER on IntegriCloud