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

Erik Pilkington via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Oct 23 12:39:03 PDT 2018


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;
----------------
Rakete1111 wrote:
> erik.pilkington wrote:
> > You should compare `IdentifierInfo`s here, rather than `StringRef`s.
> `IdentifierInfo` doesn't have a compare equal or `operator==` function. How do you propose I do that? Do I add one?
Oh sorry, I should have been more clear. An IdentifierInfo pointer should be the same for all instances of that identifier, so I just mean to compare the pointers like: `Capture.Id == Param->getIdentifier()`.


Repository:
  rC Clang

https://reviews.llvm.org/D53595





More information about the cfe-commits mailing list