[Sema] Lambdas are not part of immediate context for deduction
authorIlya Biryukov <ibiryukov@google.com>
Tue, 9 May 2023 10:06:32 +0000 (12:06 +0200)
committerIlya Biryukov <ibiryukov@google.com>
Tue, 9 May 2023 10:06:33 +0000 (12:06 +0200)
commit629170fe452f4849c89fc289d6e2cf5f08534342
tree12f131ce2363a1704d730a5ff3c5dd636e6af805
parent709098fb38b50ea376704f83b373bd41f0ed0cba
[Sema] Lambdas are not part of immediate context for deduction

This commit implements [temp.deduct]p9.
Test updates include:
- New notes in `cxx1y-init-captures.cpp`, `lambda-expressions.cpp`
  and 'warn-unused-lambda-capture.cpp'.
  This seems to be caused by diagnosing errors earlier (during
  deduction) that were previously surfaced later (during
  instantiation).
- New error `lambda-unevaluated.cpp` is in line with [temp.deduct]p9.

Reviewed By: erichkeane, #clang-language-wg

Differential Revision: https://reviews.llvm.org/D148802
28 files changed:
clang/docs/ReleaseNotes.rst
clang/include/clang/Basic/DiagnosticSemaKinds.td
clang/include/clang/Sema/Sema.h
clang/lib/Frontend/FrontendActions.cpp
clang/lib/Sema/SemaTemplateInstantiate.cpp
clang/test/CXX/expr/expr.prim/expr.prim.lambda/default-arguments.cpp
clang/test/CXX/expr/expr.prim/expr.prim.lambda/p11-1y.cpp
clang/test/CXX/expr/expr.prim/expr.prim.lambda/p23.cpp
clang/test/CXX/expr/expr.prim/expr.prim.lambda/p4.cpp
clang/test/CXX/stmt.stmt/stmt.select/stmt.if/p2.cpp
clang/test/CXX/temp/temp.deduct/p9.cpp [new file with mode: 0644]
clang/test/CXX/temp/temp.param/p15-cxx0x.cpp
clang/test/PCH/cxx1y-init-captures.cpp
clang/test/SemaCXX/cxx1y-generic-lambdas-capturing.cpp
clang/test/SemaCXX/cxx1y-generic-lambdas.cpp
clang/test/SemaCXX/cxx1y-init-captures.cpp
clang/test/SemaCXX/cxx1z-lambda-star-this.cpp
clang/test/SemaCXX/cxx20-decomposition.cpp
clang/test/SemaCXX/lambda-expressions.cpp
clang/test/SemaCXX/lambda-pack-expansion.cpp
clang/test/SemaCXX/lambda-unevaluated.cpp
clang/test/SemaCXX/vartemplate-lambda.cpp
clang/test/SemaCXX/warn-unused-lambda-capture.cpp
clang/test/SemaTemplate/concepts.cpp
clang/test/SemaTemplate/cxx1z-using-declaration.cpp
clang/test/SemaTemplate/instantiate-exception-spec-cxx11.cpp
clang/test/SemaTemplate/instantiate-local-class.cpp
clang/www/cxx_status.html