MinkowskiEngine icon indicating copy to clipboard operation
MinkowskiEngine copied to clipboard

MinkowskiEngine/src/coordinate_map_manager.cpp(717): warning: returning reference to local temporary

Open midjji opened this issue 2 years ago • 0 comments

You are returning an invalid reference which if queried may e.g. segfault when tested to see if its actually the case it is.

The problem is: auto& member_function(...) { ... if (in_map.size() == 0 || out_map.size() == 0) return detail::empty_map_functor<coordinate_type, TemplatedAllocator, CoordinateMapType, kernel_map_type>()();

...} This is a straight up programming error.

The simplest solution is to store an empty answer as a member and return a VALID reference to it instead. Want me to submit a merge?


To Reproduce git clone [email protected]:NVIDIA/MinkowskiEngine.git cd MinkowskiEngine python setup.py install


Expected behavior Do not return reference to local temporary.

midjji avatar Apr 05 '22 16:04 midjji