Skip to content

Commit ee67f78

Browse files
authored
Fix error caused by reference to local binding (#151789)
This change fixes one of the failures in #147321 Following code snippet: ` for (const auto &[CategoryName, PropSet] : PSRegistry) { J.attributeObject(CategoryName, [&] { for (const auto &[PropName, PropVal] : PropSet) { ` causes a build warning that is emitted as an error. error: reference to local binding 'PropSet' declared in enclosing lambda expression This is resolved by capturing PropSet in a local variable. Thanks Signed-off-by: Arvind Sudarsanam <[email protected]>
1 parent 1db2879 commit ee67f78

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

llvm/lib/Frontend/Offloading/PropertySet.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,9 @@ void llvm::offloading::writePropertiesToJSON(
1919
json::OStream J(Out);
2020
J.object([&] {
2121
for (const auto &[CategoryName, PropSet] : PSRegistry) {
22+
auto PropSetCapture = PropSet;
2223
J.attributeObject(CategoryName, [&] {
23-
for (const auto &[PropName, PropVal] : PropSet) {
24+
for (const auto &[PropName, PropVal] : PropSetCapture) {
2425
switch (PropVal.index()) {
2526
case 0:
2627
J.attribute(PropName, std::get<uint32_t>(PropVal));

0 commit comments

Comments
 (0)