[clang] [Clang] correct error message when assigning to const reference captured in lambda (PR #105647)
Vlad Serebrennikov via cfe-commits
cfe-commits at lists.llvm.org
Thu Aug 22 13:45:09 PDT 2024
================
@@ -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 at +1 {{initialized lambda captures are a C++14 extension}}
+ [&cnr = cn]{ // expected-note {{variable 'cnr' declared const here}}
----------------
Endilll wrote:
I'm not sure we want to go this far and look through _explicit_ declarations with deduced type.
CC @cor3ntin
https://github.com/llvm/llvm-project/pull/105647
More information about the cfe-commits
mailing list