Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GCC 13.2 build error: possible dangling reference to a temporary #811

Open
kalibaer opened this issue Jan 10, 2024 · 1 comment
Open

GCC 13.2 build error: possible dangling reference to a temporary #811

kalibaer opened this issue Jan 10, 2024 · 1 comment

Comments

@kalibaer
Copy link

GCC 13.2 finds a possible dangling reference in include/cereal/details/polymorphic_impl.hpp line 204, 218, 231:

//.... error: possibly dangling reference to a temporary [-Werror=dangling-reference]
        auto const &mapping = lookup( baseInfo, typeid(Derived), [&](){ UNREGISTERED_POLYMORPHIC_CAST_EXCEPTION(save) } );
                    ^~~~~~~
@marcosbento
Copy link

I also ran into this issue.

After some investigation this now looks it might be a compiler bug i.e. a false positive.
The return time of the lookup function is std::vector<PolymorphicCaster const *> const & and the value is a reference to a vector stored in the map StaticObject<PolymorphicCasters>::getInstance().map which is not temporary.

There are a couple of other projects that reported similar compiler regressions on GCC 13, for example 107532.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants