summaryrefslogtreecommitdiffstats
path: root/clang/test/SemaCXX/warn-shadow-in-lambdas.cpp
Commit message (Collapse)AuthorAgeFilesLines
* [C++17] Reject shadowing of capture by parameter in lambdaNicolas Lesser2018-10-251-2/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: This change rejects the shadowing of a capture by a parameter in lambdas in C++17. ``` int main() { int a; auto f = [a](int a) { return a; }; } ``` results in: ``` main.cpp:3:20: error: a lambda parameter cannot shadow an explicitly captured entity auto f = [a](int a) { return a; }; ^ main.cpp:3:13: note: variable a is explicitly captured here auto f = [a](int a) { return a; }; ^ ``` Reviewers: rsmith Reviewed By: rsmith Subscribers: lebedev.ri, erik.pilkington, cfe-commits Differential Revision: https://reviews.llvm.org/D53595 llvm-svn: 345308
* [Sema] Avoid -Wshadow warning when a "redefinition of " error is presentedAlex Lorenz2017-01-101-0/+8
| | | | | | | | | | | This commit ensures that clang avoids the redundant -Wshadow warning for variables that already get a "redefinition of " error. rdar://29067894 Differential Revision: https://reviews.llvm.org/D28350 llvm-svn: 291564
* [Sema] Avoid -Wshadow warnings for shadowed variables thatAlex Lorenz2016-11-101-3/+51
| | | | | | | | | | | | | | | | | aren't captured by lambdas with a default capture specifier This commit is a follow-up to r286354. It avoids the -Wshadow warning for variables which shadow variables that aren't captured by lambdas with a default capture specifier. It provides an additional note that points to location of the capture. The old behaviour is preserved with -Wshadow-all or -Wshadow-uncaptured-local. rdar://14984176 Differential Revision: https://reviews.llvm.org/D26448 llvm-svn: 286465
* [Sema] Avoid -Wshadow warnings for shadowed variables that aren't capturedAlex Lorenz2016-11-091-0/+91
by lambdas with an explicit capture list This commit avoids the -Wshadow warning for variables which shadow variables that aren't captured by lambdas with an explicit capture list. It provides an additional note that points to location of the explicit capture. The old behaviour is preserved with -Wshadow-all or -Wshadow-uncaptured-local. rdar://17135966 Differential Revision: https://reviews.llvm.org/D26278 llvm-svn: 286354
OpenPOWER on IntegriCloud