================
@@ -189,6 +189,11 @@ namespace ModifyingCapture {
     [=] {
       n = 1; // expected-error {{cannot assign to a variable captured by copy 
in a non-mutable lambda}}
     };
+    const int cn = 0;
+    // cxx03-cxx11-warning@+1 {{initialized lambda captures are a C++14 
extension}}
+    [&cnr = cn]{ // expected-note {{variable 'cnr' declared const here}}
----------------
Endilll wrote:

Note emitted for this line is technically correct, because according to 
https://eel.is/c++draft/expr.prim.lambda#capture-6, this is where we deduce 
type of `cnr` to be `const int&`. But I believe it would be significantly more 
helpful if we point out to a `const` in the declaration of `cn`, because that's 
the real reason we can't perform the assignment.

https://github.com/llvm/llvm-project/pull/105647
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to