Skip to content

New dangling reference warning in develop #447

Description

@jzmaddock

After updating to develop I see:

gcc.compile.c++ ..\..\..\bin.v2\libs\test\build\gcc-13\debug\x86_64\cxxstd-17-gnu\link-static\pch-off\threadapi-win32\threading-multi\visibility-hidden\framework.o
In file included from D:/data/boost/boost/libs/test/src/framework.cpp:16:
..\..\../boost/test/impl/framework.ipp: In function 'bool boost::unit_test::framework::impl::parse_filters(boost::unit_test::test_unit_id, boost::unit_test::test_unit_id_list&, boost::unit_test::test_unit_id_list&)':
..\..\../boost/test/impl/framework.ipp:403:37: warning: possibly dangling reference to a temporary [-Wdangling-reference]
403 |     std::vector<std::string> const& filters = runtime_config::get<std::vector<std::string> >( runtime_config::btrt_run_filters );
    |                                     ^~~~~~~                                                                     ..\..\../boost/test/impl/framework.ipp:403:93: note: the temporary was destroyed at the end of the full expression 'boost::unit_test::runtime_config::get<std::vector<std::__cxx11::basic_string<char> > >(boost::unit_test::basic_cstring<const char>(boost::unit_test::runtime_config::btrt_run_filters))'
403 |     std::vector<std::string> const& filters = runtime_config::get<std::vector<std::string> >( runtime_config::btrt_run_filters );
    |                                               ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
..\..\../boost/test/impl/framework.ipp: In function 'void boost::unit_test::framework::impl::setup_loggers()':
..\..\../boost/test/impl/framework.ipp:1000:45: warning: possibly dangling reference to a temporary [-Wdangling-reference]
1000 |             const std::vector<std::string>& v_output_format = runtime_config::get< std::vector<std::string> >( runtime_config::btrt_combined_logger ) ;
     |                                             ^~~~~~~~~~~~~~~
..\..\../boost/test/impl/framework.ipp:1000:110: note: the temporary was destroyed at the end of the full expression 'boost::unit_test::runtime_config::get<std::vector<std::__cxx11::basic_string<char> > >(boost::unit_test::basic_cstring<const char>(boost::unit_test::runtime_config::btrt_combined_logger))'
1000 |             const std::vector<std::string>& v_output_format = runtime_config::get< std::vector<std::string> >( runtime_config::btrt_combined_logger ) ;
     |                                                               ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~

With gcc-13 Mingw.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions