[clang] [Clang] correct error message when assigning to const reference captured in lambda (PR #105647)

Shafik Yaghmour via cfe-commits cfe-commits at lists.llvm.org
Tue Sep 2 19:26:06 PDT 2025


================
@@ -194,6 +194,11 @@ namespace ModifyingCapture {
     [=] {
       n = 1; // expected-error {{cannot assign to a variable captured by copy in a non-mutable lambda}}
     };
+    const int cn = 0;
----------------
shafik wrote:

I think we should have also tested a `constexpr` variable case and maybe a `auto &` assigned from `cn` as well just to cover a more complete test set.

https://github.com/llvm/llvm-project/pull/105647


More information about the cfe-commits mailing list