https://bugs.llvm.org/show_bug.cgi?id=49409
Bug ID: 49409
Summary: const variable cannot be implicitly captured in a
lambda with no capture-default specified
Product: clang
Version: trunk
Hardware: PC
OS: All
Status: NEW
Severity: enhancement
Priority: P
Component: C++2a
Assignee: unassignedclangb...@nondot.org
Reporter: hewi...@gmail.com
CC: blitzrak...@gmail.com, erik.pilking...@gmail.com,
llvm-bugs@lists.llvm.org, richard-l...@metafoo.co.uk
Clang rejected the following code with -std=c++20 flag (but GCC and MSVC do
not):
auto f() {
const auto x = 1;
return [] (auto) { return x; };
}
godbolt: https://godbolt.org/z/1174Tv
discussion:
https://stackoverflow.com/questions/66456916/implicitly-capture-const-variable-in-a-template-lambda-with-no-capture-default-s
--
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