[PATCH] D53595: [C++17] Reject shadowing of capture by parameter in lambda

2018-10-25 Thread Nicolas Lesser via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes. Closed by commit rC345308: [C++17] Reject shadowing of capture by parameter in lambda (authored by Rakete, committed by ). Repository: rC Clang https://reviews.llvm.org/D53595 Files: include/clang/Basic/Diagnostic

[PATCH] D53595: [C++17] Reject shadowing of capture by parameter in lambda

2018-10-25 Thread Nicolas Lesser via Phabricator via cfe-commits
Rakete updated this revision to Diff 171174. Rakete added a comment. Update DR list. https://reviews.llvm.org/D53595 Files: include/clang/Basic/DiagnosticSemaKinds.td include/clang/Sema/Sema.h lib/Sema/SemaLambda.cpp test/CXX/drs/dr22xx.cpp test/SemaCXX/warn-shadow-in-lambdas.

[PATCH] D53595: [C++17] Reject shadowing of capture by parameter in lambda

2018-10-25 Thread Richard Smith - zygoloid via Phabricator via cfe-commits
rsmith added a comment. In https://reviews.llvm.org/D53595#1276346, @Rakete wrote: > In https://reviews.llvm.org/D53595#1276330, @rsmith wrote: > > > In https://reviews.llvm.org/D53595#1273848, @Rakete wrote: > > > > > Addresed review comments :) > > > > > > I updated the dr status file b

[PATCH] D53595: [C++17] Reject shadowing of capture by parameter in lambda

2018-10-25 Thread Nicolas Lesser via Phabricator via cfe-commits
Rakete added a comment. In https://reviews.llvm.org/D53595#1276330, @rsmith wrote: > In https://reviews.llvm.org/D53595#1273848, @Rakete wrote: > > > Addresed review comments :) > > > > I updated the dr status file but a lot of unrelated changes made it in. Is > > this okay? > > > Please

[PATCH] D53595: [C++17] Reject shadowing of capture by parameter in lambda

2018-10-25 Thread Richard Smith - zygoloid via Phabricator via cfe-commits
rsmith added a comment. Also please mark PR39428 as fixed once this is submitted :) Repository: rC Clang https://reviews.llvm.org/D53595 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-co

[PATCH] D53595: [C++17] Reject shadowing of capture by parameter in lambda

2018-10-25 Thread Richard Smith - zygoloid via Phabricator via cfe-commits
rsmith accepted this revision. rsmith added a comment. This revision is now accepted and ready to land. In https://reviews.llvm.org/D53595#1273848, @Rakete wrote: > Addresed review comments :) > > I updated the dr status file but a lot of unrelated changes made it in. Is > this okay? Pleas

[PATCH] D53595: [C++17] Reject shadowing of capture by parameter in lambda

2018-10-24 Thread Nicolas Lesser via Phabricator via cfe-commits
Rakete updated this revision to Diff 170828. Rakete added a comment. Addresed review comments :) I updated the dr status file but a lot of unrelated changes made it in. Is this okay? Repository: rC Clang https://reviews.llvm.org/D53595 Files: include/clang/Basic/DiagnosticSemaKin

[PATCH] D53595: [C++17] Reject shadowing of capture by parameter in lambda

2018-10-23 Thread Richard Smith - zygoloid via Phabricator via cfe-commits
rsmith added a comment. For what it's worth, I think the language rule here is wrong, and we should instead be injecting the simple-captures into the lambda's function scope: http://lists.isocpp.org/core/2018/10/5145.php But this appears to be a correct implementation of the rule as written, so

[PATCH] D53595: [C++17] Reject shadowing of capture by parameter in lambda

2018-10-23 Thread Richard Smith - zygoloid via Phabricator via cfe-commits
rsmith added inline comments. Comment at: include/clang/Basic/DiagnosticSemaKinds.td:6636-6638 + def warn_cxx14_compat_parameter_shadow_capture : ExtWarn< +"a lambda parameter that shadows a capture is incompatible with C++ " +"standards before C++17">, InGroup;

[PATCH] D53595: [C++17] Reject shadowing of capture by parameter in lambda

2018-10-23 Thread Roman Lebedev via Phabricator via cfe-commits
lebedev.ri added inline comments. Comment at: include/clang/Sema/Sema.h:5584 + void addLambdaParameters( + const SmallVectorImpl &Captures, + CXXMethodDecl *CallOperator, Scope *CurScope); Maybe this should be `ArrayRef Captures` instead? Repository

[PATCH] D53595: [C++17] Reject shadowing of capture by parameter in lambda

2018-10-23 Thread Nicolas Lesser via Phabricator via cfe-commits
Rakete updated this revision to Diff 170757. Rakete added a comment. Use correct clang and version spelling. Repository: rC Clang https://reviews.llvm.org/D53595 Files: include/clang/Basic/DiagnosticSemaKinds.td include/clang/Sema/Sema.h lib/Sema/SemaLambda.cpp test/SemaCXX/w

[PATCH] D53595: [C++17] Reject shadowing of capture by parameter in lambda

2018-10-23 Thread Nicolas Lesser via Phabricator via cfe-commits
Rakete updated this revision to Diff 170748. Rakete added a comment. Addressed review comments! :) Thanks Repository: rC Clang https://reviews.llvm.org/D53595 Files: include/clang/Basic/DiagnosticSemaKinds.td include/clang/Sema/Sema.h lib/Sema/SemaLambda.cpp test/SemaCXX/warn

[PATCH] D53595: [C++17] Reject shadowing of capture by parameter in lambda

2018-10-23 Thread Erik Pilkington via Phabricator via cfe-commits
erik.pilkington added inline comments. Comment at: lib/Sema/SemaLambda.cpp:510 +for (const auto &Capture: Captures) { + if (Capture.Id && Capture.Id->getName() == Param->getName()) { +Error = true; Rakete wrote: > erik.pilkington

[PATCH] D53595: [C++17] Reject shadowing of capture by parameter in lambda

2018-10-23 Thread Nicolas Lesser via Phabricator via cfe-commits
Rakete added inline comments. Comment at: lib/Sema/SemaLambda.cpp:510 +for (const auto &Capture: Captures) { + if (Capture.Id && Capture.Id->getName() == Param->getName()) { +Error = true; erik.pilkington wrote: > You should compa

[PATCH] D53595: [C++17] Reject shadowing of capture by parameter in lambda

2018-10-23 Thread Erik Pilkington via Phabricator via cfe-commits
erik.pilkington added a comment. Thanks for working on this! Can you update www/cxx_dr_status.html too? Comment at: lib/Sema/SemaLambda.cpp:507 + bool Error = false; + if (getLangOpts().CPlusPlus17) { +// Resolution of CWG 2211 in C++17 renders shadowing ill-f

[PATCH] D53595: [C++17] Reject shadowing of capture by parameter in lambda

2018-10-23 Thread Nicolas Lesser via Phabricator via cfe-commits
Rakete created this revision. Rakete added a reviewer: rsmith. 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