diff options
author | Richard Smith <richard-llvm@metafoo.co.uk> | 2019-07-29 19:59:45 +0000 |
---|---|---|
committer | Richard Smith <richard-llvm@metafoo.co.uk> | 2019-07-29 19:59:45 +0000 |
commit | a625da716c8300d2ff9ec2313e7b38892bcfcfcb (patch) | |
tree | 9f9e3b53c77485cbd63f9c9b6ba5f69d8ce92e50 /clang/lib/Sema/SemaLambda.cpp | |
parent | 8e9516f2aa495749edd2adb7c8fe0778ee462c17 (diff) | |
download | llvm-a625da716c8300d2ff9ec2313e7b38892bcfcfcb.zip llvm-a625da716c8300d2ff9ec2313e7b38892bcfcfcb.tar.gz llvm-a625da716c8300d2ff9ec2313e7b38892bcfcfcb.tar.bz2 |
When determining whether a lambda-expression is implicitly constexpr,
check the formal rules rather than seeing if the normal checks produce a
diagnostic.
This fixes the handling of C++2a extensions in lambdas in C++17 mode,
as well as some corner cases in earlier language modes where we issue
diagnostics for things other than not satisfying the formal constexpr
requirements.
llvm-svn: 367254
Diffstat (limited to 'clang/lib/Sema/SemaLambda.cpp')
-rw-r--r-- | clang/lib/Sema/SemaLambda.cpp | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/clang/lib/Sema/SemaLambda.cpp b/clang/lib/Sema/SemaLambda.cpp index 986524e..e7c51a3 100644 --- a/clang/lib/Sema/SemaLambda.cpp +++ b/clang/lib/Sema/SemaLambda.cpp @@ -1776,10 +1776,9 @@ ExprResult Sema::BuildLambdaExpr(SourceLocation StartLoc, SourceLocation EndLoc, !CallOperator->isConstexpr() && !isa<CoroutineBodyStmt>(CallOperator->getBody()) && !Class->getDeclContext()->isDependentContext()) { - TentativeAnalysisScope DiagnosticScopeGuard(*this); CallOperator->setConstexprKind( - (CheckConstexprFunctionDecl(CallOperator) && - CheckConstexprFunctionBody(CallOperator, CallOperator->getBody())) + CheckConstexprFunctionDefinition(CallOperator, + CheckConstexprKind::CheckValid) ? CSK_constexpr : CSK_unspecified); } |