diff options
author | Mariya Podchishchaeva <mariya.podchishchaeva@intel.com> | 2023-04-28 06:26:35 -0400 |
---|---|---|
committer | Mariya Podchishchaeva <mariya.podchishchaeva@intel.com> | 2023-04-28 07:26:30 -0400 |
commit | 0fb84bc7fdec1c20c2461e54d5c994939fe5b47f (patch) | |
tree | 3c7cfac9ea7bc5fb01054f9a7556f344927020ba /clang/docs | |
parent | cf59f649ffa14818487713fd2636992b62a69a76 (diff) | |
download | llvm-0fb84bc7fdec1c20c2461e54d5c994939fe5b47f.tar.gz |
[clang] Diagnose shadowing of lambda's template parameter by a capture
expr.prim.lambda.capture p5 says:
If an identifier in a capture appears as the declarator-id of a parameter of
the lambda-declarator's parameter-declaration-clause or as the name of a
template parameter of the lambda-expression's template-parameter-list,
the program is ill-formed.
and also has the following example:
```
auto h = [y = 0]<typename y>(y) { return 0; };
```
which now results in
```
error: declaration of 'y' shadows template parameter
auto l1 = [y = 0]<typename y>(y) { return 0; };
^
note: template parameter is declared here
auto l1 = [y = 0]<typename y>(y) { return 0; };
^
```
Fixes https://github.com/llvm/llvm-project/issues/61105
Reviewed By: shafik, cor3ntin
Differential Revision: https://reviews.llvm.org/D148712
Diffstat (limited to 'clang/docs')
-rw-r--r-- | clang/docs/ReleaseNotes.rst | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/clang/docs/ReleaseNotes.rst b/clang/docs/ReleaseNotes.rst index 8082e9d9f323..a61e6615b937 100644 --- a/clang/docs/ReleaseNotes.rst +++ b/clang/docs/ReleaseNotes.rst @@ -233,6 +233,8 @@ Improvements to Clang's diagnostics - ``-Wformat`` now recognizes ``%lb`` for the ``printf``/``scanf`` family of functions. (`#62247: <https://github.com/llvm/llvm-project/issues/62247>`_). +- Clang now diagnoses shadowing of lambda's template parameter by a capture. + (`#61105: <https://github.com/llvm/llvm-project/issues/61105>`_). Bug Fixes in This Version ------------------------- |