[PATCH] D52064: [Sema] Add a note pointing to the first use of an implicit capture

Vedant Kumar via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Sep 13 16:38:08 PDT 2018


vsk created this revision.
vsk added reviewers: rsmith, erichkeane.

When it's not possible to initialize an implicit capture, add a note
pointing to the first use of the captured variable.

Example (the `note` is new):

lambda-expressions.cpp:81:15: error: no matching constructor for initialization of 'G'

  return [=]{
          ^

lambda-expressions.cpp:82:24: note: implicitly capturing 'g', first used here

  const G* gg = &g;
                 ^

As suggested in https://reviews.llvm.org/D50927.


https://reviews.llvm.org/D52064

Files:
  clang/include/clang/Basic/DiagnosticSemaKinds.td
  clang/include/clang/Sema/Sema.h
  clang/lib/Frontend/FrontendActions.cpp
  clang/lib/Sema/SemaLambda.cpp
  clang/lib/Sema/SemaTemplateInstantiate.cpp
  clang/test/CXX/expr/expr.prim/expr.prim.lambda/p14.cpp
  clang/test/SemaCXX/lambda-expressions.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D52064.165402.patch
Type: text/x-patch
Size: 6857 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20180913/fb0a3ea4/attachment-0001.bin>


More information about the cfe-commits mailing list