On Mon, May 29, 2023 at 8:26 AM Sam Varshavchik <mrsam@courier-mta.com> wrote:
Richard Shaw writes:

> error: possibly dangling reference to a temporary [-Werror=dangling-
> reference]
>   315 |                 const auto & parents = 
> dae.root().selectNodes("//*[@sid]/..");

The quickest solution is just add a pragma to shut it up.

> The code in question[2] is:
>   // InstanceWithExtra and other <instance_*> with "url" attribute
> const auto & instances = root().selectNodes(

Find where selectNodes() is defined. Add

#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdangling-reference"

before the definition, and

#pragma GCC diagnostic pop

after it.

That's what I ended up doing, it turns out there were structures like this in about 7 places in that file and several more in another, it just got through two before the build failed previously. I ended up using the approach for the whole file and then fixed a couple of #include <cstdint> since you don't get it for free anymore and the build completed.

Thanks!
Richard