Skip to content

Conversation

@edolstra
Copy link
Member

@edolstra edolstra commented Apr 2, 2025

Motivation

This shuts up the GCC 14 warnings about the functions in json-utils.hh that return references, e.g.

../src/libstore/derivations.cc:1354:78: warning: possibly dangling reference to a temporary [-Wdangling-reference]
 1354 |         for (auto & [outputName, output] : getObject(valueAt(json, "outputs"))) {

There is no actual lifetime problem here but I can't convince GCC of that. So let's just disable the warning.

Context


Add 👍 to pull requests you find important.

The Nix maintainer team uses a GitHub project board to schedule and track reviews.

This shuts up the GCC 14 warnings about the functions in json-utils.hh
that return references, e.g.

  ../src/libstore/derivations.cc:1354:78: warning: possibly dangling reference to a temporary [-Wdangling-reference]
   1354 |         for (auto & [outputName, output] : getObject(valueAt(json, "outputs"))) {

There is no actual lifetime problem here but I can't convince GCC of
that. So let's just disable the warning.
@edolstra edolstra added the backport 2.28-maintenance Automatically creates a PR against the branch label Apr 2, 2025
@edolstra edolstra requested a review from Ericson2314 as a code owner April 2, 2025 19:24
@Mic92
Copy link
Member

Mic92 commented Apr 2, 2025

That's a rather important compiler warning I would like to keep. I fixed all of them in #12896

@Mic92 Mic92 closed this Apr 2, 2025
@Mic92
Copy link
Member

Mic92 commented Apr 2, 2025

Follow up: #12902

@cole-h cole-h deleted the no-dangling-reference branch April 3, 2025 03:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport 2.28-maintenance Automatically creates a PR against the branch

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants