author: Andres Salomon description: work around https://github.com/llvm/llvm-project/issues/48582 ../../media/base/cdm_promise_adapter.cc:99:66: error: reference to local binding 'promise_id' declared in enclosing function 'media::CdmPromiseAdapter::Clear' "media", "CdmPromise", TRACE_ID_WITH_SCOPE("CdmPromise", promise_id), ^ ../../media/base/cdm_promise_adapter.cc:97:15: note: 'promise_id' declared here for (auto& [promise_id, promise] : promises_) { ^ This is some kind of clang14 scope bug, whereby variable are defined in a structured binding, and then used inside of a (valid, but) different scope. Eg, auto& [foo, bar, baz] = sizing_tree->CreateSizingData(); do { auto& x = bar; } while (0); auto x = [&](GridTrackSizingDirection lambdavar) { for (auto& i : foo) { ... } } The compiler gets confused about scope and spits out an error. The workaround is to define the variable not in a structured binding. --- a/media/base/cdm_promise_adapter.cc +++ b/media/base/cdm_promise_adapter.cc @@ -94,7 +94,9 @@ void CdmPromiseAdapter::RejectPromise(ui void CdmPromiseAdapter::Clear(ClearReason reason) { // Reject all outstanding promises. DCHECK(thread_checker_.CalledOnValidThread()); - for (auto& [promise_id, promise] : promises_) { + for (auto& [p_id, p] : promises_) { + auto& promise_id = p_id; + auto& promise = p; TRACE_EVENT_NESTABLE_ASYNC_END1( "media", "CdmPromise", TRACE_ID_WITH_SCOPE("CdmPromise", promise_id), "status", "cleared"); --- a/third_party/blink/renderer/core/layout/ng/grid/ng_grid_layout_algorithm.cc +++ b/third_party/blink/renderer/core/layout/ng/grid/ng_grid_layout_algorithm.cc @@ -1798,8 +1798,10 @@ void NGGridLayoutAlgorithm::CompleteTrac bool* opt_needs_additional_pass) const { DCHECK(sizing_subtree); - auto& [grid_items, layout_data, subtree_size] = + auto& [g_i, l_d, subtree_size] = sizing_subtree.SubtreeRootData(); + auto& grid_items = g_i; + auto& layout_data = l_d; const bool is_for_columns = track_direction == kForColumns; const bool has_non_definite_track = --- a/content/browser/service_worker/service_worker_context_wrapper.cc +++ b/content/browser/service_worker/service_worker_context_wrapper.cc @@ -1393,7 +1393,8 @@ void ServiceWorkerContextWrapper::MaybeP return; } - auto [document_url, key, callback] = std::move(*request); + auto [d_u, key, callback] = std::move(*request); + auto document_url = std::move(d_u); DCHECK(document_url.is_valid()); TRACE_EVENT1("ServiceWorker",