Browse Source

Workaround GCC compiler bug with constexpr support

Christophe Riccio 9 years ago
parent
commit
71401d14aa

+ 7 - 0
glm/detail/setup.hpp

@@ -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

+ 0 - 8
glm/detail/type_vec1.hpp

@@ -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 --

+ 1 - 1
glm/detail/type_vec2.hpp

@@ -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 --

+ 1 - 1
glm/detail/type_vec2.inl

@@ -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)
 	{}
 

+ 1 - 1
glm/detail/type_vec3.hpp

@@ -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 --

+ 1 - 1
glm/detail/type_vec3.inl

@@ -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)
 	{}
 

+ 1 - 1
glm/detail/type_vec4.hpp

@@ -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 --

+ 1 - 1
glm/detail/type_vec4.inl

@@ -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)
 	{}