Using gcc 13.2.1
[ 50%] Building CXX object CMakeFiles/lightmaputil.dir/src/LightmapUtil.cpp.o
In file included from /home/micwoj92/LightmapUtil/src/LightmapUtil.h:4,
from /home/micwoj92/LightmapUtil/src/LightmapUtil.cpp:10:
/home/micwoj92/LightmapUtil/src/bsplib.h: In member function ‘dvertex_t& dvertex_t::operator+(dvertex_t)’:
/home/micwoj92/LightmapUtil/src/bsplib.h:367:24: warning: reference to local variable ‘rhs’ returned [-Wreturn-local-addr]
367 | return rhs;
| ^~~
/home/micwoj92/LightmapUtil/src/bsplib.h:362:40: note: declared here
362 | dvertex_t& operator+(dvertex_t rhs)
| ~~~~~~~~~~^~~
/home/micwoj92/LightmapUtil/src/bsplib.h: In member function ‘dvertex_t& dvertex_t::operator-(dvertex_t)’:
/home/micwoj92/LightmapUtil/src/bsplib.h:374:24: warning: reference to local variable ‘rhs’ returned [-Wreturn-local-addr]
374 | return rhs;
| ^~~
/home/micwoj92/LightmapUtil/src/bsplib.h:369:40: note: declared here
369 | dvertex_t& operator-(dvertex_t rhs)
| ~~~~~~~~~~^~~
Using clang 16.0.6 this code also generates warning:
[ 50%] Building CXX object CMakeFiles/lightmaputil.dir/src/LightmapUtil.cpp.o
In file included from /home/micwoj92/LightmapUtil/src/LightmapUtil.cpp:10:
In file included from /home/micwoj92/LightmapUtil/src/LightmapUtil.h:4:
/home/micwoj92/LightmapUtil/src/bsplib.h:367:10: warning: reference to stack memory associated with parameter 'rhs' returned [-Wreturn-stack-address]
return rhs;
^~~
/home/micwoj92/LightmapUtil/src/bsplib.h:374:10: warning: reference to stack memory associated with parameter 'rhs' returned [-Wreturn-stack-address]
return rhs;
^~~
2 warnings generated.
Using gcc 13.2.1
Using clang 16.0.6 this code also generates warning: