[PATCH] D36572: Implemented P0409R2 - Allow lambda capture [=, this]

Hamza Sood via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Sun Aug 13 08:52:52 PDT 2017


hamzasood added inline comments.


================
Comment at: lib/Sema/SemaLambda.cpp:959
+                         ? diag::ext_equals_this_lambda_capture_cxx2a
+                         : diag::warn_cxx1z_compat_equals_this_lambda_capture);
 
----------------
faisalv wrote:
> Shouldn't we try and hit the 'continue' (that u deleted) if warnings (and extension warnings) are turned into errors? 
That's an interesting scenario which admittedly I hadn't considered.

I based this implementation on the [[ https://github.com/llvm-mirror/clang/blob/7602b13a8e8b5656afd6327d112b76b39f836e5b/lib/Sema/SemaLambda.cpp#L935 | '*this' capture handling ]] from the same loop. When a '*this' capture is seen pre-C++1z, an extension warning is emitted and then the capture is processed as normal (i.e. without consideration of that warning potentially becoming an error).

I also looked at other places where extension warnings are emitted and I couldn't find any special handling for warnings becoming errors.


https://reviews.llvm.org/D36572





More information about the cfe-commits mailing list