[PATCH] D50927: [Sema] Remove location from implicit capture init expr

Richard Smith - zygoloid via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Aug 27 14:22:47 PDT 2018


rsmith added a comment.

I would prefer that we use the location of the capture-default as the location of all the implicitly captured fields, rather than using an invalid location.



================
Comment at: clang/lib/Sema/SemaDecl.cpp:10689
 
-      S.DiagRuntimeBehavior(DRE->getBeginLoc(), DRE,
+      S.DiagRuntimeBehavior(DRE->getBeginOrDeclLoc(), DRE,
                             S.PDiag(diag)
----------------
I'm a bit surprised you updated this call to `DeclRefExpr::getBeginLoc()` (and no others). I think this should be unreachable for a `DeclRefExpr` that refers to an implicit lambda capture, because such a lambda-capture cannot refer to itself from its own (implicit) initializer.


https://reviews.llvm.org/D50927





More information about the cfe-commits mailing list