You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Building with clang 23 and warnings-as-errors fails in framework/rendering/postprocessing_computepass.cpp:
framework/rendering/postprocessing_computepass.cpp:154:33: error:
object backing the pointer will be destroyed at the end of the
full-expression [-Werror,-Wdangling-gsl]
Looking at the code, I think the warning is a true positive rather than noise. PipelineLayout::get_resources() returns const std::vector<ShaderResource> by value (a fresh copy each call), and the transition code calls it three times:
So begin() and end() come from two different temporary vectors, both are destroyed at the end of the statement, the later end()
comparison uses a third temporary, and resource->qualifiers dereferences an iterator into a destroyed vector.
It probably never crashes in practice because, as #841 noted, this class appears to be unused - but it is still compiled everywhere, so
clang 23 makes it a build failure for -Werror configurations.
Two possible ways out:
Call get_resources() once and keep it in a local:
constauto resources = pipeline_layout.get_resources();
auto resource = std::find_if(resources.begin(), resources.end(),
[&storage](constauto &res) { ... });
if (resource == resources.end())
Building with clang 23 and warnings-as-errors fails in framework/rendering/postprocessing_computepass.cpp:
Looking at the code, I think the warning is a true positive rather than noise.
PipelineLayout::get_resources()returnsconst std::vector<ShaderResource>by value (a fresh copy each call), and the transition code calls it three times:So
begin()andend()come from two different temporary vectors, both are destroyed at the end of the statement, the laterend()comparison uses a third temporary, and
resource->qualifiersdereferences an iterator into a destroyed vector.It probably never crashes in practice because, as #841 noted, this class appears to be unused - but it is still compiled everywhere, so
clang 23 makes it a build failure for -Werror configurations.
Two possible ways out:
or
Happy to send a PR for option 1 if that is the preferred direction.