Workaround GCC compiler bug with constexpr support

This commit is contained in:
Christophe Riccio 2016-05-05 19:58:12 +02:00
parent 152c71abff
commit 71401d14aa
8 changed files with 13 additions and 14 deletions

View File

@ -737,6 +737,13 @@
# define GLM_RELAXED_CONSTEXPR const
#endif
// GCC 4.6 has a bug causing a compiler crash
#if GLM_COMPILER & GLM_COMPILER_GCC
# define GLM_CONSTEXPR_GCC
#else
# define GLM_CONSTEXPR_GCC GLM_CONSTEXPR
#endif
#ifdef GLM_FORCE_EXPLICIT_CTOR
# define GLM_EXPLICIT explicit
#else

View File

@ -102,14 +102,6 @@ namespace glm
// -- Explicit basic constructors --
GLM_FUNC_DECL GLM_CONSTEXPR_CTOR explicit tvec1(ctor);
// GCC 4.6 has a bug causing a compiler crash
# if GLM_COMPILER & GLM_COMPILER_GCC
# define GLM_CONSTEXPR_GCC
# else
# define GLM_CONSTEXPR_GCC GLM_CONSTEXPR
# endif
GLM_FUNC_DECL GLM_CONSTEXPR_GCC explicit tvec1(T scalar);
// -- Conversion vector constructors --

View File

@ -102,7 +102,7 @@ namespace glm
// -- Explicit basic constructors --
GLM_FUNC_DECL GLM_CONSTEXPR_CTOR explicit tvec2(ctor);
GLM_FUNC_DECL GLM_CONSTEXPR explicit tvec2(T scalar);
GLM_FUNC_DECL GLM_CONSTEXPR_GCC explicit tvec2(T scalar);
GLM_FUNC_DECL GLM_CONSTEXPR tvec2(T s1, T s2);
// -- Conversion constructors --

View File

@ -72,7 +72,7 @@ namespace glm
{}
template <typename T, precision P>
GLM_FUNC_QUALIFIER GLM_CONSTEXPR tvec2<T, P>::tvec2(T scalar)
GLM_FUNC_QUALIFIER GLM_CONSTEXPR_GCC tvec2<T, P>::tvec2(T scalar)
: x(scalar), y(scalar)
{}

View File

@ -103,7 +103,7 @@ namespace glm
// -- Explicit basic constructors --
GLM_FUNC_DECL GLM_CONSTEXPR_CTOR explicit tvec3(ctor);
GLM_FUNC_DECL GLM_CONSTEXPR explicit tvec3(T scalar);
GLM_FUNC_DECL GLM_CONSTEXPR_GCC explicit tvec3(T scalar);
GLM_FUNC_DECL GLM_CONSTEXPR tvec3(T a, T b, T c);
// -- Conversion scalar constructors --

View File

@ -89,7 +89,7 @@ namespace glm
{}
template <typename T, precision P>
GLM_FUNC_QUALIFIER GLM_CONSTEXPR tvec3<T, P>::tvec3(T scalar)
GLM_FUNC_QUALIFIER GLM_CONSTEXPR_GCC tvec3<T, P>::tvec3(T scalar)
: x(scalar), y(scalar), z(scalar)
{}

View File

@ -158,7 +158,7 @@ namespace detail
// -- Explicit basic constructors --
GLM_FUNC_DECL GLM_CONSTEXPR_CTOR explicit tvec4(ctor);
GLM_FUNC_DECL GLM_CONSTEXPR explicit tvec4(T scalar);
GLM_FUNC_DECL GLM_CONSTEXPR_GCC explicit tvec4(T scalar);
GLM_FUNC_DECL GLM_CONSTEXPR tvec4(T a, T b, T c, T d);
// -- Conversion scalar constructors --

View File

@ -63,7 +63,7 @@ namespace glm
{}
template <typename T, precision P>
GLM_FUNC_QUALIFIER GLM_CONSTEXPR tvec4<T, P>::tvec4(T scalar)
GLM_FUNC_QUALIFIER GLM_CONSTEXPR_GCC tvec4<T, P>::tvec4(T scalar)
: x(scalar), y(scalar), z(scalar), w(scalar)
{}