https://bugs.llvm.org/show_bug.cgi?id=46102
Bug ID: 46102
Summary: Non mutable lambdas still see some non const
references
Product: clang
Version: unspecified
Hardware: PC
OS: Linux
Status: NEW
Severity: enhancement
Priority: P
Component: C++11
Assignee: unassignedclangb...@nondot.org
Reporter: raf...@espindo.la
CC: blitzrak...@gmail.com, dgre...@apple.com,
erik.pilking...@gmail.com, llvm-bugs@lists.llvm.org,
richard-l...@metafoo.co.uk
Both clang and gcc agree that the following should not compile
struct foo {
void func();
};
void zed(const foo& v) {
[v]() mutable {
v.func();
}();
}
The problem being that the member corresponding to v is now const.
But the following function compiles with clang while gcc rejects it
void bar(foo& v) {
[v]() {
[v]() mutable {
v.func();
}();
}();
}
The operator() of the outer lambda should be const, so the v in the inner
lambda should be const too, and gcc is correct in rejecting this as far as I
can tell.
--
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs