-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Description
Continuing from #523. The issue there was fixed, but I was using an older version of GLM when I reported that. After updating to the latest master (61e8432), I'm getting new errors and warnings.
I'm using Ubuntu 15.10 and compiling with both GCC 5.2.1 and with Clang 3.6.2. I usually compile with all possible warnings turned on, but I'm gradually turning on warnings with the below logs.
tvec4<T, P> operator-(tvec1<T, P> const & v1, tvec4<T, P> const & v2)
Error with both GCC and Clang:
# GCC:
In file included from ../thirdparty/glm/detail/type_vec4.hpp:460:0,
from ../thirdparty/glm/vec4.hpp:6,
from ../thirdparty/glm/glm.hpp:70,
from Release/swig_glm_wrap.cxx:2810:
../thirdparty/glm/detail/type_vec4.inl: In instantiation of ‘glm::tvec4<T, P> glm::operator-(const glm::tvec1<T, P>&, const glm::tvec4<T, P>&) [with T = f
loat; glm::precision P = (glm::precision)0u]’:
Release/swig_glm_wrap.cxx:125271:165: required from here
../thirdparty/glm/detail/type_vec4.inl:689:26: error: no matching function for call to ‘glm::tvec4<float, (glm::precision)0u>::tvec4(const glm::tvec1<floa
t, (glm::precision)0u>&)’
return tvec4<T, P>(v1) -= v2;
^
# Clang:
In file included from Release/swig_glm_wrap.cxx:2810:
In file included from ../thirdparty/glm/gtc/../glm.hpp:70:
In file included from ../thirdparty/glm/gtx/../vec4.hpp:6:
In file included from ../thirdparty/glm/detail/type_vec4.hpp:460:
../thirdparty/glm/detail/type_vec4.inl:689:10: error: no matching conversion for functional-style cast from 'const tvec1<float, (glm::precision)0U>' to
'tvec4<float, (glm::precision)0U>'
return tvec4<T, P>(v1) -= v2;
^~~~~~~~~~~~~~
The above error can be fixed by this change:
template <typename T, precision P>
GLM_FUNC_QUALIFIER tvec4<T, P> operator-(tvec1<T, P> const & v1, tvec4<T, P> const & v2)
{
- return tvec4<T, P>(v1) -= v2;
+ return tvec4<T, P>(v1.x) -= v2;
}
But I'm not sure if there should rather be vec4 constructor which accepts a single vec1, or some kind of conversion from a vec1 to a vec4 (or to a scalar).
A warning from Clang
This one is a bit weird. Clang gives this warning even without -pedantic
:
In file included from ../src/boundingbox.cpp:1:
In file included from ../src/boundingbox.h:6:
In file included from ../thirdparty/glm/detail/../mat4x4.hpp:6:
../thirdparty/glm/detail/type_mat4x4.hpp:34:45: warning: inline function 'glm::tmat4x4<float, glm::precision::aligned_lowp>::tmat4x4' is not defined
[-Wundefined-inline]
GLM_FUNC_DECL GLM_CONSTEXPR_CTOR explicit tmat4x4(ctor);
^
The above warning doesn't happen if I remove GLM_CONSTEXPR_CTOR
from the declaration and the definition, which is a bit weird.
Anonymous structs (warnings with -pedantic
)
With -pedantic
, the following warnings are given by both GCC and Clang (similar warnings for vec2, vec3, vec4 and quaternion):
# GCC
In file included from ../thirdparty/glm/detail/type_mat4x4.hpp:7:0,
from ../thirdparty/glm/mat4x4.hpp:6,
from ../src/boundingbox.h:6,
from ../src/boundingbox.cpp:1:
../thirdparty/glm/detail/type_vec4.hpp:34:27: warning: ISO C++ prohibits anonymous structs [-Wpedantic]
struct { T x, y, z, w;};
^
../thirdparty/glm/detail/type_vec4.hpp:35:28: warning: ISO C++ prohibits anonymous structs [-Wpedantic]
struct { T r, g, b, a; };
^
../thirdparty/glm/detail/type_vec4.hpp:36:28: warning: ISO C++ prohibits anonymous structs [-Wpedantic]
struct { T s, t, p, q; };
^
# Clang
In file included from ../src/boundingbox.cpp:1:
In file included from ../src/boundingbox.h:6:
In file included from ../thirdparty/glm/mat4x4.hpp:6:
In file included from ../thirdparty/glm/detail/type_mat4x4.hpp:7:
../thirdparty/glm/detail/type_vec4.hpp:34:5: warning: anonymous structs are a GNU extension [-Wgnu-anonymous-struct]
struct { T x, y, z, w;};
^
../thirdparty/glm/detail/type_vec4.hpp:35:5: warning: anonymous structs are a GNU extension [-Wgnu-anonymous-struct]
struct { T r, g, b, a; };
^
../thirdparty/glm/detail/type_vec4.hpp:36:5: warning: anonymous structs are a GNU extension [-Wgnu-anonymous-struct]
struct { T s, t, p, q; };
^
../thirdparty/glm/detail/type_vec4.hpp:34:5: warning: anonymous types declared in an anonymous union are an extension [-Wnested-anon-types]
struct { T x, y, z, w;};
^
../thirdparty/glm/detail/type_vec4.hpp:35:5: warning: anonymous types declared in an anonymous union are an extension [-Wnested-anon-types]
struct { T r, g, b, a; };
^
../thirdparty/glm/detail/type_vec4.hpp:36:5: warning: anonymous types declared in an anonymous union are an extension [-Wnested-anon-types]
struct { T s, t, p, q; };
^
This didn't happen a few months ago, so GLM_HAS_UNRESTRICTED_UNIONS
might be working differently than the old GLM_HAS_ANONYMOUS_UNION
?