KhronosGroup / KhronosGroup/OpenCOLLADA

possibly dangling reference to a temporary

Open
#661 4 comments 0 reactions 0 assignees View on GitHub
Dominant language
C++
Stars
679
Forks
260
PR merge metrics
No merged PRs in 30d

Description

/tmp/OpenCOLLADA-1.6.68/DAEValidator/library/src/Dae.cpp: In member function ‘virtual void opencollada::Dae::readFile(const std::string&)’:
/tmp/OpenCOLLADA-1.6.68/DAEValidator/library/src/Dae.cpp:79:30: error: possibly dangling reference to a temporary [-Werror=dangling-reference]
79 | const auto & instances = root().selectNodes(
| ^~~~~~~~~
/tmp/OpenCOLLADA-1.6.68/DAEValidator/library/src/Dae.cpp:79:60: note: the temporary was destroyed at the end of the full expression ‘((opencollada::Dae*)this)->opencollada::Dae::.opencollada::XmlDoc::root().opencollada::XmlNode::selectNodes(std::operator+(__cxx11::basic_string<_CharT, _Traits, _Alloc>&&, const __cxx11::basic_string<_CharT, _Traits, _Alloc>&) [with _CharT = char; _Traits = char_traits; _Alloc = allocator](opencollada::Strings::instance_visual_scene))’
79 | const auto & instances = root().selectNodes(
| ~~~~~~~~~~~~~~~~~~^
80 | xpath_all + Strings::instance_animation +
gcc 13.1.0

Contributor guide

No contributing guide indexed for this repository

Research direction

Start at DAEValidator/library/src/Dae.cpp:79 and inspect the lifetime of the value returned by root().selectNodes(). Confirm the build with GCC 13.1 reproduces the dangling-reference error, then verify that the warning no longer occurs and the affected Dae::readFile path still builds successfully.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
build-system
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.