Browse Source

Fixed C++11 explicit conversion operators detection #282

Christophe Riccio 11 years ago
parent
commit
6a1a673b41
3 changed files with 13 additions and 2 deletions
  1. 8 0
      glm/detail/setup.hpp
  2. 4 2
      glm/gtc/quaternion.hpp
  3. 1 0
      readme.txt

+ 8 - 0
glm/detail/setup.hpp

@@ -506,6 +506,14 @@
 	((GLM_LANG & GLM_LANG_CXX0X_FLAG) && (GLM_COMPILER & GLM_COMPILER_GCC) && (GLM_COMPILER >= GLM_COMPILER_GCC43)) || \
 	__has_feature(cxx_rvalue_references))
 
+// N2437
+#define GLM_HAS_EXPLICIT_CONVERSION_OPERATORS ( \
+	(GLM_LANG & GLM_LANG_CXX11_FLAG) || \
+	((GLM_LANG & GLM_LANG_CXX0X_FLAG) && ((GLM_COMPILER & GLM_COMPILER_VC) && (GLM_COMPILER >= GLM_COMPILER_VC2013))) || \
+	((GLM_LANG & GLM_LANG_CXX0X_FLAG) && ((GLM_COMPILER & GLM_COMPILER_INTEL) && (GLM_COMPILER >= GLM_COMPILER_INTEL14))) || \
+	((GLM_LANG & GLM_LANG_CXX0X_FLAG) && (GLM_COMPILER & GLM_COMPILER_GCC) && (GLM_COMPILER >= GLM_COMPILER_GCC45)) || \
+	__has_feature(cxx_explicit_conversions)
+
 #define GLM_HAS_STL_ARRAY ( \
 	(GLM_LANG & GLM_LANG_CXX11_FLAG) || \
 	((GLM_LANG & GLM_LANG_CXX0X_FLAG) && ((GLM_COMPILER & GLM_COMPILER_VC) && (GLM_COMPILER >= GLM_COMPILER_VC2010))) || \

+ 4 - 2
glm/gtc/quaternion.hpp

@@ -113,8 +113,10 @@ namespace glm
 #		endif
 		
 		// explicit conversion operators
-		GLM_FUNC_DECL explicit operator tmat3x3<T, P>();
-		GLM_FUNC_DECL explicit operator tmat4x4<T, P>();
+#		if GLM_HAS_EXPLICIT_CONVERSION_OPERATORS
+			GLM_FUNC_DECL explicit operator tmat3x3<T, P>();
+			GLM_FUNC_DECL explicit operator tmat4x4<T, P>();
+#		endif
 		
 		/// Create a quaternion from two normalized axis
 		/// 

+ 1 - 0
readme.txt

@@ -67,6 +67,7 @@ GLM 0.9.6.1: 2014-12-XX
 --------------------------------------------------------------------------------
 Fixes:
 - Fixed scalar uaddCarry build error with Cuda #276
+- Fixed C++11 explicit conversion operators detection #282
 
 ================================================================================
 GLM 0.9.6.0: 2014-11-30