vsk added inline comments.

================
Comment at: clang/lib/Sema/SemaDecl.cpp:10689
 
-      S.DiagRuntimeBehavior(DRE->getBeginLoc(), DRE,
+      S.DiagRuntimeBehavior(DRE->getBeginOrDeclLoc(), DRE,
                             S.PDiag(diag)
----------------
rsmith wrote:
> 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.
IIUC, that's exactly what this visitor (SelfReferenceChecker) diagnoses. The 
only test I found which exercises this code path is SemaCXX/uninitialized.cpp. 
The relevant portion is updated in this diff, but to summarize, there's a 
DeclRefExpr in the CXXConstructExpr initializer generated for `a1` which 
self-refers to `a1`.


https://reviews.llvm.org/D50927



_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to