Can't figure out: binding dereferenced null pointer to reference has undefined behavior
Posted: Wed May 31, 2017 3:01 pm
Guys,
I am getting a puzzling warning when building the latest release of simbody. Actually it only occurs when building examples, but since I am having problems downstream I think this needs to be addressed. The warning is below. Any advice?
Thanks
Sam
In file included from /Users/Sam/github/simbody/SimTKcommon/src/PrivateInstantiations.cpp:28:
In file included from /Users/Sam/github/simbody/SimTKcommon/src/../Geometry/src/PolygonalMeshImpl.h:27:
In file included from /Users/Sam/github/simbody/SimTKcommon/Geometry/include/SimTKcommon/internal/PolygonalMesh.h:27:
In file included from /Users/Sam/github/simbody/SimTKcommon/./include/SimTKcommon/Simmatrix.h:36:
In file included from /Users/Sam/github/simbody/SimTKcommon/Scalar/include/SimTKcommon/Scalar.h:42:
/Users/Sam/github/simbody/SimTKcommon/Scalar/include/SimTKcommon/internal/NTraits.h:1076:1: warning: binding dereferenced null pointer to reference has undefined behavior
[-Wnull-dereference]
SimTK_DEFINE_REAL_NTRAITS(float);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Users/Sam/github/simbody/SimTKcommon/Scalar/include/SimTKcommon/internal/NTraits.h:982:62: note: expanded from macro 'SimTK_DEFINE_REAL_NTRAITS'
static T& imag(T&) { assert(false); return *reinterpret_cast<T*>(0); } \
^~~~~~~~~~~~~~~~~~~~~~~~
I am getting a puzzling warning when building the latest release of simbody. Actually it only occurs when building examples, but since I am having problems downstream I think this needs to be addressed. The warning is below. Any advice?
Thanks
Sam
In file included from /Users/Sam/github/simbody/SimTKcommon/src/PrivateInstantiations.cpp:28:
In file included from /Users/Sam/github/simbody/SimTKcommon/src/../Geometry/src/PolygonalMeshImpl.h:27:
In file included from /Users/Sam/github/simbody/SimTKcommon/Geometry/include/SimTKcommon/internal/PolygonalMesh.h:27:
In file included from /Users/Sam/github/simbody/SimTKcommon/./include/SimTKcommon/Simmatrix.h:36:
In file included from /Users/Sam/github/simbody/SimTKcommon/Scalar/include/SimTKcommon/Scalar.h:42:
/Users/Sam/github/simbody/SimTKcommon/Scalar/include/SimTKcommon/internal/NTraits.h:1076:1: warning: binding dereferenced null pointer to reference has undefined behavior
[-Wnull-dereference]
SimTK_DEFINE_REAL_NTRAITS(float);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Users/Sam/github/simbody/SimTKcommon/Scalar/include/SimTKcommon/internal/NTraits.h:982:62: note: expanded from macro 'SimTK_DEFINE_REAL_NTRAITS'
static T& imag(T&) { assert(false); return *reinterpret_cast<T*>(0); } \
^~~~~~~~~~~~~~~~~~~~~~~~