Browse Source

GCC: Fix noexcept warnings on hash functions

Fix warnings on hash functions with GCC and -Wnoexcept:
* Add GLM_HAS_NOEXCEPT flag & GLM_NOEXCEPT #define to setup.hpp.
* Add GLM_NOEXCEPT to hash functions in hash.hpp.
* Add GLM_NOEXCEPT to matrix operator[] accessors.
* Add gtx_hash.cpp and a test to verify all hash overloads compile.
  Configure with -DCMAKE_CXX_FLAGS="-Werror -Wnoexcept" to test.
Charles Huber 3 years ago
parent
commit
4b6284e39d

+ 12 - 0
glm/detail/setup.hpp

@@ -360,6 +360,18 @@
 #	define GLM_HAS_BITSCAN_WINDOWS 0
 #endif
 
+#if GLM_LANG & GLM_LANG_CXX11_FLAG
+#	define GLM_HAS_NOEXCEPT 1
+#else
+#	define GLM_HAS_NOEXCEPT 0
+#endif
+
+#if GLM_HAS_NOEXCEPT
+#	define GLM_NOEXCEPT noexcept
+#else
+#	define GLM_NOEXCEPT
+#endif
+
 ///////////////////////////////////////////////////////////////////////////////////
 // OpenMP
 #ifdef _OPENMP

+ 2 - 2
glm/detail/type_mat2x2.hpp

@@ -27,8 +27,8 @@ namespace glm
 		typedef length_t length_type;
 		GLM_FUNC_DECL static GLM_CONSTEXPR length_type length() { return 2; }
 
-		GLM_FUNC_DECL col_type & operator[](length_type i);
-		GLM_FUNC_DECL GLM_CONSTEXPR col_type const& operator[](length_type i) const;
+		GLM_FUNC_DECL col_type & operator[](length_type i) GLM_NOEXCEPT;
+		GLM_FUNC_DECL GLM_CONSTEXPR col_type const& operator[](length_type i) const GLM_NOEXCEPT;
 
 		// -- Constructors --
 

+ 2 - 2
glm/detail/type_mat2x2.inl

@@ -217,14 +217,14 @@ namespace glm
 	// -- Accesses --
 
 	template<typename T, qualifier Q>
-	GLM_FUNC_QUALIFIER typename mat<2, 2, T, Q>::col_type& mat<2, 2, T, Q>::operator[](typename mat<2, 2, T, Q>::length_type i)
+	GLM_FUNC_QUALIFIER typename mat<2, 2, T, Q>::col_type& mat<2, 2, T, Q>::operator[](typename mat<2, 2, T, Q>::length_type i) GLM_NOEXCEPT
 	{
 		assert(i < this->length());
 		return this->value[i];
 	}
 
 	template<typename T, qualifier Q>
-	GLM_FUNC_QUALIFIER GLM_CONSTEXPR typename mat<2, 2, T, Q>::col_type const& mat<2, 2, T, Q>::operator[](typename mat<2, 2, T, Q>::length_type i) const
+	GLM_FUNC_QUALIFIER GLM_CONSTEXPR typename mat<2, 2, T, Q>::col_type const& mat<2, 2, T, Q>::operator[](typename mat<2, 2, T, Q>::length_type i) const GLM_NOEXCEPT
 	{
 		assert(i < this->length());
 		return this->value[i];

+ 2 - 2
glm/detail/type_mat2x3.hpp

@@ -28,8 +28,8 @@ namespace glm
 		typedef length_t length_type;
 		GLM_FUNC_DECL static GLM_CONSTEXPR length_type length() { return 2; }
 
-		GLM_FUNC_DECL col_type & operator[](length_type i);
-		GLM_FUNC_DECL GLM_CONSTEXPR col_type const& operator[](length_type i) const;
+		GLM_FUNC_DECL col_type & operator[](length_type i) GLM_NOEXCEPT;
+		GLM_FUNC_DECL GLM_CONSTEXPR col_type const& operator[](length_type i) const GLM_NOEXCEPT;
 
 		// -- Constructors --
 

+ 2 - 2
glm/detail/type_mat2x3.inl

@@ -217,14 +217,14 @@ namespace glm
 	// -- Accesses --
 
 	template<typename T, qualifier Q>
-	GLM_FUNC_QUALIFIER typename mat<2, 3, T, Q>::col_type & mat<2, 3, T, Q>::operator[](typename mat<2, 3, T, Q>::length_type i)
+	GLM_FUNC_QUALIFIER typename mat<2, 3, T, Q>::col_type & mat<2, 3, T, Q>::operator[](typename mat<2, 3, T, Q>::length_type i) GLM_NOEXCEPT
 	{
 		assert(i < this->length());
 		return this->value[i];
 	}
 
 	template<typename T, qualifier Q>
-	GLM_FUNC_QUALIFIER GLM_CONSTEXPR typename mat<2, 3, T, Q>::col_type const& mat<2, 3, T, Q>::operator[](typename mat<2, 3, T, Q>::length_type i) const
+	GLM_FUNC_QUALIFIER GLM_CONSTEXPR typename mat<2, 3, T, Q>::col_type const& mat<2, 3, T, Q>::operator[](typename mat<2, 3, T, Q>::length_type i) const GLM_NOEXCEPT
 	{
 		assert(i < this->length());
 		return this->value[i];

+ 2 - 2
glm/detail/type_mat2x4.hpp

@@ -28,8 +28,8 @@ namespace glm
 		typedef length_t length_type;
 		GLM_FUNC_DECL static GLM_CONSTEXPR length_type length() { return 2; }
 
-		GLM_FUNC_DECL col_type & operator[](length_type i);
-		GLM_FUNC_DECL GLM_CONSTEXPR col_type const& operator[](length_type i) const;
+		GLM_FUNC_DECL col_type & operator[](length_type i) GLM_NOEXCEPT;
+		GLM_FUNC_DECL GLM_CONSTEXPR col_type const& operator[](length_type i) const GLM_NOEXCEPT;
 
 		// -- Constructors --
 

+ 2 - 2
glm/detail/type_mat2x4.inl

@@ -219,14 +219,14 @@ namespace glm
 	// -- Accesses --
 
 	template<typename T, qualifier Q>
-	GLM_FUNC_QUALIFIER typename mat<2, 4, T, Q>::col_type & mat<2, 4, T, Q>::operator[](typename mat<2, 4, T, Q>::length_type i)
+	GLM_FUNC_QUALIFIER typename mat<2, 4, T, Q>::col_type & mat<2, 4, T, Q>::operator[](typename mat<2, 4, T, Q>::length_type i) GLM_NOEXCEPT
 	{
 		assert(i < this->length());
 		return this->value[i];
 	}
 
 	template<typename T, qualifier Q>
-	GLM_FUNC_QUALIFIER GLM_CONSTEXPR typename mat<2, 4, T, Q>::col_type const& mat<2, 4, T, Q>::operator[](typename mat<2, 4, T, Q>::length_type i) const
+	GLM_FUNC_QUALIFIER GLM_CONSTEXPR typename mat<2, 4, T, Q>::col_type const& mat<2, 4, T, Q>::operator[](typename mat<2, 4, T, Q>::length_type i) const GLM_NOEXCEPT
 	{
 		assert(i < this->length());
 		return this->value[i];

+ 2 - 2
glm/detail/type_mat3x2.hpp

@@ -28,8 +28,8 @@ namespace glm
 		typedef length_t length_type;
 		GLM_FUNC_DECL static GLM_CONSTEXPR length_type length() { return 3; }
 
-		GLM_FUNC_DECL col_type & operator[](length_type i);
-		GLM_FUNC_DECL GLM_CONSTEXPR col_type const& operator[](length_type i) const;
+		GLM_FUNC_DECL col_type & operator[](length_type i) GLM_NOEXCEPT;
+		GLM_FUNC_DECL GLM_CONSTEXPR col_type const& operator[](length_type i) const GLM_NOEXCEPT;
 
 		// -- Constructors --
 

+ 2 - 2
glm/detail/type_mat3x2.inl

@@ -236,14 +236,14 @@ namespace glm
 	// -- Accesses --
 
 	template<typename T, qualifier Q>
-	GLM_FUNC_QUALIFIER typename mat<3, 2, T, Q>::col_type & mat<3, 2, T, Q>::operator[](typename mat<3, 2, T, Q>::length_type i)
+	GLM_FUNC_QUALIFIER typename mat<3, 2, T, Q>::col_type & mat<3, 2, T, Q>::operator[](typename mat<3, 2, T, Q>::length_type i) GLM_NOEXCEPT
 	{
 		assert(i < this->length());
 		return this->value[i];
 	}
 
 	template<typename T, qualifier Q>
-	GLM_FUNC_QUALIFIER GLM_CONSTEXPR typename mat<3, 2, T, Q>::col_type const& mat<3, 2, T, Q>::operator[](typename mat<3, 2, T, Q>::length_type i) const
+	GLM_FUNC_QUALIFIER GLM_CONSTEXPR typename mat<3, 2, T, Q>::col_type const& mat<3, 2, T, Q>::operator[](typename mat<3, 2, T, Q>::length_type i) const GLM_NOEXCEPT
 	{
 		assert(i < this->length());
 		return this->value[i];

+ 2 - 2
glm/detail/type_mat3x3.hpp

@@ -27,8 +27,8 @@ namespace glm
 		typedef length_t length_type;
 		GLM_FUNC_DECL static GLM_CONSTEXPR length_type length() { return 3; }
 
-		GLM_FUNC_DECL col_type & operator[](length_type i);
-		GLM_FUNC_DECL GLM_CONSTEXPR col_type const& operator[](length_type i) const;
+		GLM_FUNC_DECL col_type & operator[](length_type i) GLM_NOEXCEPT;
+		GLM_FUNC_DECL GLM_CONSTEXPR col_type const& operator[](length_type i) const GLM_NOEXCEPT;
 
 		// -- Constructors --
 

+ 2 - 2
glm/detail/type_mat3x3.inl

@@ -238,14 +238,14 @@ namespace glm
 	// -- Accesses --
 
 	template<typename T, qualifier Q>
-	GLM_FUNC_QUALIFIER typename mat<3, 3, T, Q>::col_type & mat<3, 3, T, Q>::operator[](typename mat<3, 3, T, Q>::length_type i)
+	GLM_FUNC_QUALIFIER typename mat<3, 3, T, Q>::col_type & mat<3, 3, T, Q>::operator[](typename mat<3, 3, T, Q>::length_type i) GLM_NOEXCEPT
 	{
 		assert(i < this->length());
 		return this->value[i];
 	}
 
 	template<typename T, qualifier Q>
-	GLM_FUNC_QUALIFIER GLM_CONSTEXPR typename mat<3, 3, T, Q>::col_type const& mat<3, 3, T, Q>::operator[](typename mat<3, 3, T, Q>::length_type i) const
+	GLM_FUNC_QUALIFIER GLM_CONSTEXPR typename mat<3, 3, T, Q>::col_type const& mat<3, 3, T, Q>::operator[](typename mat<3, 3, T, Q>::length_type i) const GLM_NOEXCEPT
 	{
 		assert(i < this->length());
 		return this->value[i];

+ 2 - 2
glm/detail/type_mat3x4.hpp

@@ -28,8 +28,8 @@ namespace glm
 		typedef length_t length_type;
 		GLM_FUNC_DECL static GLM_CONSTEXPR length_type length() { return 3; }
 
-		GLM_FUNC_DECL col_type & operator[](length_type i);
-		GLM_FUNC_DECL GLM_CONSTEXPR col_type const& operator[](length_type i) const;
+		GLM_FUNC_DECL col_type & operator[](length_type i) GLM_NOEXCEPT;
+		GLM_FUNC_DECL GLM_CONSTEXPR col_type const& operator[](length_type i) const GLM_NOEXCEPT;
 
 		// -- Constructors --
 

+ 2 - 2
glm/detail/type_mat3x4.inl

@@ -242,14 +242,14 @@ namespace glm
 	// -- Accesses --
 
 	template<typename T, qualifier Q>
-	GLM_FUNC_QUALIFIER typename mat<3, 4, T, Q>::col_type & mat<3, 4, T, Q>::operator[](typename mat<3, 4, T, Q>::length_type i)
+	GLM_FUNC_QUALIFIER typename mat<3, 4, T, Q>::col_type & mat<3, 4, T, Q>::operator[](typename mat<3, 4, T, Q>::length_type i) GLM_NOEXCEPT
 	{
 		assert(i < this->length());
 		return this->value[i];
 	}
 
 	template<typename T, qualifier Q>
-	GLM_FUNC_QUALIFIER GLM_CONSTEXPR typename mat<3, 4, T, Q>::col_type const& mat<3, 4, T, Q>::operator[](typename mat<3, 4, T, Q>::length_type i) const
+	GLM_FUNC_QUALIFIER GLM_CONSTEXPR typename mat<3, 4, T, Q>::col_type const& mat<3, 4, T, Q>::operator[](typename mat<3, 4, T, Q>::length_type i) const GLM_NOEXCEPT
 	{
 		assert(i < this->length());
 		return this->value[i];

+ 2 - 2
glm/detail/type_mat4x2.hpp

@@ -28,8 +28,8 @@ namespace glm
 		typedef length_t length_type;
 		GLM_FUNC_DECL static GLM_CONSTEXPR length_type length() { return 4; }
 
-		GLM_FUNC_DECL col_type & operator[](length_type i);
-		GLM_FUNC_DECL GLM_CONSTEXPR col_type const& operator[](length_type i) const;
+		GLM_FUNC_DECL col_type & operator[](length_type i) GLM_NOEXCEPT;
+		GLM_FUNC_DECL GLM_CONSTEXPR col_type const& operator[](length_type i) const GLM_NOEXCEPT;
 
 		// -- Constructors --
 

+ 2 - 2
glm/detail/type_mat4x2.inl

@@ -255,14 +255,14 @@ namespace glm
 	// -- Accesses --
 
 	template<typename T, qualifier Q>
-	GLM_FUNC_QUALIFIER typename mat<4, 2, T, Q>::col_type & mat<4, 2, T, Q>::operator[](typename mat<4, 2, T, Q>::length_type i)
+	GLM_FUNC_QUALIFIER typename mat<4, 2, T, Q>::col_type & mat<4, 2, T, Q>::operator[](typename mat<4, 2, T, Q>::length_type i) GLM_NOEXCEPT
 	{
 		assert(i < this->length());
 		return this->value[i];
 	}
 
 	template<typename T, qualifier Q>
-	GLM_FUNC_QUALIFIER GLM_CONSTEXPR typename mat<4, 2, T, Q>::col_type const& mat<4, 2, T, Q>::operator[](typename mat<4, 2, T, Q>::length_type i) const
+	GLM_FUNC_QUALIFIER GLM_CONSTEXPR typename mat<4, 2, T, Q>::col_type const& mat<4, 2, T, Q>::operator[](typename mat<4, 2, T, Q>::length_type i) const GLM_NOEXCEPT
 	{
 		assert(i < this->length());
 		return this->value[i];

+ 2 - 2
glm/detail/type_mat4x3.hpp

@@ -28,8 +28,8 @@ namespace glm
 		typedef length_t length_type;
 		GLM_FUNC_DECL static GLM_CONSTEXPR length_type length() { return 4; }
 
-		GLM_FUNC_DECL col_type & operator[](length_type i);
-		GLM_FUNC_DECL GLM_CONSTEXPR col_type const& operator[](length_type i) const;
+		GLM_FUNC_DECL col_type & operator[](length_type i) GLM_NOEXCEPT;
+		GLM_FUNC_DECL GLM_CONSTEXPR col_type const& operator[](length_type i) const GLM_NOEXCEPT;
 
 		// -- Constructors --
 

+ 2 - 2
glm/detail/type_mat4x3.inl

@@ -255,14 +255,14 @@ namespace glm
 	// -- Accesses --
 
 	template<typename T, qualifier Q>
-	GLM_FUNC_QUALIFIER typename mat<4, 3, T, Q>::col_type & mat<4, 3, T, Q>::operator[](typename mat<4, 3, T, Q>::length_type i)
+	GLM_FUNC_QUALIFIER typename mat<4, 3, T, Q>::col_type & mat<4, 3, T, Q>::operator[](typename mat<4, 3, T, Q>::length_type i) GLM_NOEXCEPT
 	{
 		assert(i < this->length());
 		return this->value[i];
 	}
 
 	template<typename T, qualifier Q>
-	GLM_FUNC_QUALIFIER GLM_CONSTEXPR typename mat<4, 3, T, Q>::col_type const& mat<4, 3, T, Q>::operator[](typename mat<4, 3, T, Q>::length_type i) const
+	GLM_FUNC_QUALIFIER GLM_CONSTEXPR typename mat<4, 3, T, Q>::col_type const& mat<4, 3, T, Q>::operator[](typename mat<4, 3, T, Q>::length_type i) const GLM_NOEXCEPT
 	{
 		assert(i < this->length());
 		return this->value[i];

+ 2 - 2
glm/detail/type_mat4x4.hpp

@@ -27,8 +27,8 @@ namespace glm
 		typedef length_t length_type;
 		GLM_FUNC_DECL static GLM_CONSTEXPR length_type length(){return 4;}
 
-		GLM_FUNC_DECL col_type & operator[](length_type i);
-		GLM_FUNC_DECL GLM_CONSTEXPR col_type const& operator[](length_type i) const;
+		GLM_FUNC_DECL col_type & operator[](length_type i) GLM_NOEXCEPT;
+		GLM_FUNC_DECL GLM_CONSTEXPR col_type const& operator[](length_type i) const GLM_NOEXCEPT;
 
 		// -- Constructors --
 

+ 2 - 2
glm/detail/type_mat4x4.inl

@@ -286,14 +286,14 @@ namespace glm
 	// -- Accesses --
 
 	template<typename T, qualifier Q>
-	GLM_FUNC_QUALIFIER typename mat<4, 4, T, Q>::col_type & mat<4, 4, T, Q>::operator[](typename mat<4, 4, T, Q>::length_type i)
+	GLM_FUNC_QUALIFIER typename mat<4, 4, T, Q>::col_type & mat<4, 4, T, Q>::operator[](typename mat<4, 4, T, Q>::length_type i) GLM_NOEXCEPT
 	{
 		assert(i < this->length());
 		return this->value[i];
 	}
 
 	template<typename T, qualifier Q>
-	GLM_FUNC_QUALIFIER GLM_CONSTEXPR typename mat<4, 4, T, Q>::col_type const& mat<4, 4, T, Q>::operator[](typename mat<4, 4, T, Q>::length_type i) const
+	GLM_FUNC_QUALIFIER GLM_CONSTEXPR typename mat<4, 4, T, Q>::col_type const& mat<4, 4, T, Q>::operator[](typename mat<4, 4, T, Q>::length_type i) const GLM_NOEXCEPT
 	{
 		assert(i < this->length());
 		return this->value[i];

+ 15 - 15
glm/gtx/hash.hpp

@@ -51,91 +51,91 @@ namespace std
 	template<typename T, glm::qualifier Q>
 	struct hash<glm::vec<1, T,Q> >
 	{
-		GLM_FUNC_DECL size_t operator()(glm::vec<1, T, Q> const& v) const;
+		GLM_FUNC_DECL size_t operator()(glm::vec<1, T, Q> const& v) const GLM_NOEXCEPT;
 	};
 
 	template<typename T, glm::qualifier Q>
 	struct hash<glm::vec<2, T,Q> >
 	{
-		GLM_FUNC_DECL size_t operator()(glm::vec<2, T, Q> const& v) const;
+		GLM_FUNC_DECL size_t operator()(glm::vec<2, T, Q> const& v) const GLM_NOEXCEPT;
 	};
 
 	template<typename T, glm::qualifier Q>
 	struct hash<glm::vec<3, T,Q> >
 	{
-		GLM_FUNC_DECL size_t operator()(glm::vec<3, T, Q> const& v) const;
+		GLM_FUNC_DECL size_t operator()(glm::vec<3, T, Q> const& v) const GLM_NOEXCEPT;
 	};
 
 	template<typename T, glm::qualifier Q>
 	struct hash<glm::vec<4, T,Q> >
 	{
-		GLM_FUNC_DECL size_t operator()(glm::vec<4, T, Q> const& v) const;
+		GLM_FUNC_DECL size_t operator()(glm::vec<4, T, Q> const& v) const GLM_NOEXCEPT;
 	};
 
 	template<typename T, glm::qualifier Q>
 	struct hash<glm::qua<T,Q>>
 	{
-		GLM_FUNC_DECL size_t operator()(glm::qua<T, Q> const& q) const;
+		GLM_FUNC_DECL size_t operator()(glm::qua<T, Q> const& q) const GLM_NOEXCEPT;
 	};
 
 	template<typename T, glm::qualifier Q>
 	struct hash<glm::tdualquat<T,Q> >
 	{
-		GLM_FUNC_DECL size_t operator()(glm::tdualquat<T,Q> const& q) const;
+		GLM_FUNC_DECL size_t operator()(glm::tdualquat<T,Q> const& q) const GLM_NOEXCEPT;
 	};
 
 	template<typename T, glm::qualifier Q>
 	struct hash<glm::mat<2, 2, T,Q> >
 	{
-		GLM_FUNC_DECL size_t operator()(glm::mat<2, 2, T,Q> const& m) const;
+		GLM_FUNC_DECL size_t operator()(glm::mat<2, 2, T,Q> const& m) const GLM_NOEXCEPT;
 	};
 
 	template<typename T, glm::qualifier Q>
 	struct hash<glm::mat<2, 3, T,Q> >
 	{
-		GLM_FUNC_DECL size_t operator()(glm::mat<2, 3, T,Q> const& m) const;
+		GLM_FUNC_DECL size_t operator()(glm::mat<2, 3, T,Q> const& m) const GLM_NOEXCEPT;
 	};
 
 	template<typename T, glm::qualifier Q>
 	struct hash<glm::mat<2, 4, T,Q> >
 	{
-		GLM_FUNC_DECL size_t operator()(glm::mat<2, 4, T,Q> const& m) const;
+		GLM_FUNC_DECL size_t operator()(glm::mat<2, 4, T,Q> const& m) const GLM_NOEXCEPT;
 	};
 
 	template<typename T, glm::qualifier Q>
 	struct hash<glm::mat<3, 2, T,Q> >
 	{
-		GLM_FUNC_DECL size_t operator()(glm::mat<3, 2, T,Q> const& m) const;
+		GLM_FUNC_DECL size_t operator()(glm::mat<3, 2, T,Q> const& m) const GLM_NOEXCEPT;
 	};
 
 	template<typename T, glm::qualifier Q>
 	struct hash<glm::mat<3, 3, T,Q> >
 	{
-		GLM_FUNC_DECL size_t operator()(glm::mat<3, 3, T,Q> const& m) const;
+		GLM_FUNC_DECL size_t operator()(glm::mat<3, 3, T,Q> const& m) const GLM_NOEXCEPT;
 	};
 
 	template<typename T, glm::qualifier Q>
 	struct hash<glm::mat<3, 4, T,Q> >
 	{
-		GLM_FUNC_DECL size_t operator()(glm::mat<3, 4, T,Q> const& m) const;
+		GLM_FUNC_DECL size_t operator()(glm::mat<3, 4, T,Q> const& m) const GLM_NOEXCEPT;
 	};
 
 	template<typename T, glm::qualifier Q>
 	struct hash<glm::mat<4, 2, T,Q> >
 	{
-		GLM_FUNC_DECL size_t operator()(glm::mat<4, 2, T,Q> const& m) const;
+		GLM_FUNC_DECL size_t operator()(glm::mat<4, 2, T,Q> const& m) const GLM_NOEXCEPT;
 	};
 
 	template<typename T, glm::qualifier Q>
 	struct hash<glm::mat<4, 3, T,Q> >
 	{
-		GLM_FUNC_DECL size_t operator()(glm::mat<4, 3, T,Q> const& m) const;
+		GLM_FUNC_DECL size_t operator()(glm::mat<4, 3, T,Q> const& m) const GLM_NOEXCEPT;
 	};
 
 	template<typename T, glm::qualifier Q>
 	struct hash<glm::mat<4, 4, T,Q> >
 	{
-		GLM_FUNC_DECL size_t operator()(glm::mat<4, 4, T,Q> const& m) const;
+		GLM_FUNC_DECL size_t operator()(glm::mat<4, 4, T,Q> const& m) const GLM_NOEXCEPT;
 	};
 } // namespace std
 

+ 15 - 15
glm/gtx/hash.inl

@@ -22,14 +22,14 @@ namespace detail
 namespace std
 {
 	template<typename T, glm::qualifier Q>
-	GLM_FUNC_QUALIFIER size_t hash<glm::vec<1, T, Q>>::operator()(glm::vec<1, T, Q> const& v) const
+	GLM_FUNC_QUALIFIER size_t hash<glm::vec<1, T, Q>>::operator()(glm::vec<1, T, Q> const& v) const GLM_NOEXCEPT
 	{
 		hash<T> hasher;
 		return hasher(v.x);
 	}
 
 	template<typename T, glm::qualifier Q>
-	GLM_FUNC_QUALIFIER size_t hash<glm::vec<2, T, Q>>::operator()(glm::vec<2, T, Q> const& v) const
+	GLM_FUNC_QUALIFIER size_t hash<glm::vec<2, T, Q>>::operator()(glm::vec<2, T, Q> const& v) const GLM_NOEXCEPT
 	{
 		size_t seed = 0;
 		hash<T> hasher;
@@ -39,7 +39,7 @@ namespace std
 	}
 
 	template<typename T, glm::qualifier Q>
-	GLM_FUNC_QUALIFIER size_t hash<glm::vec<3, T, Q>>::operator()(glm::vec<3, T, Q> const& v) const
+	GLM_FUNC_QUALIFIER size_t hash<glm::vec<3, T, Q>>::operator()(glm::vec<3, T, Q> const& v) const GLM_NOEXCEPT
 	{
 		size_t seed = 0;
 		hash<T> hasher;
@@ -50,7 +50,7 @@ namespace std
 	}
 
 	template<typename T, glm::qualifier Q>
-	GLM_FUNC_QUALIFIER size_t hash<glm::vec<4, T, Q>>::operator()(glm::vec<4, T, Q> const& v) const
+	GLM_FUNC_QUALIFIER size_t hash<glm::vec<4, T, Q>>::operator()(glm::vec<4, T, Q> const& v) const GLM_NOEXCEPT
 	{
 		size_t seed = 0;
 		hash<T> hasher;
@@ -62,7 +62,7 @@ namespace std
 	}
 
 	template<typename T, glm::qualifier Q>
-	GLM_FUNC_QUALIFIER size_t hash<glm::qua<T, Q>>::operator()(glm::qua<T,Q> const& q) const
+	GLM_FUNC_QUALIFIER size_t hash<glm::qua<T, Q>>::operator()(glm::qua<T,Q> const& q) const GLM_NOEXCEPT
 	{
 		size_t seed = 0;
 		hash<T> hasher;
@@ -74,7 +74,7 @@ namespace std
 	}
 
 	template<typename T, glm::qualifier Q>
-	GLM_FUNC_QUALIFIER size_t hash<glm::tdualquat<T, Q>>::operator()(glm::tdualquat<T, Q> const& q) const
+	GLM_FUNC_QUALIFIER size_t hash<glm::tdualquat<T, Q>>::operator()(glm::tdualquat<T, Q> const& q) const GLM_NOEXCEPT
 	{
 		size_t seed = 0;
 		hash<glm::qua<T, Q>> hasher;
@@ -84,7 +84,7 @@ namespace std
 	}
 
 	template<typename T, glm::qualifier Q>
-	GLM_FUNC_QUALIFIER size_t hash<glm::mat<2, 2, T, Q>>::operator()(glm::mat<2, 2, T, Q> const& m) const
+	GLM_FUNC_QUALIFIER size_t hash<glm::mat<2, 2, T, Q>>::operator()(glm::mat<2, 2, T, Q> const& m) const GLM_NOEXCEPT
 	{
 		size_t seed = 0;
 		hash<glm::vec<2, T, Q>> hasher;
@@ -94,7 +94,7 @@ namespace std
 	}
 
 	template<typename T, glm::qualifier Q>
-	GLM_FUNC_QUALIFIER size_t hash<glm::mat<2, 3, T, Q>>::operator()(glm::mat<2, 3, T, Q> const& m) const
+	GLM_FUNC_QUALIFIER size_t hash<glm::mat<2, 3, T, Q>>::operator()(glm::mat<2, 3, T, Q> const& m) const GLM_NOEXCEPT
 	{
 		size_t seed = 0;
 		hash<glm::vec<3, T, Q>> hasher;
@@ -104,7 +104,7 @@ namespace std
 	}
 
 	template<typename T, glm::qualifier Q>
-	GLM_FUNC_QUALIFIER size_t hash<glm::mat<2, 4, T, Q>>::operator()(glm::mat<2, 4, T, Q> const& m) const
+	GLM_FUNC_QUALIFIER size_t hash<glm::mat<2, 4, T, Q>>::operator()(glm::mat<2, 4, T, Q> const& m) const GLM_NOEXCEPT
 	{
 		size_t seed = 0;
 		hash<glm::vec<4, T, Q>> hasher;
@@ -114,7 +114,7 @@ namespace std
 	}
 
 	template<typename T, glm::qualifier Q>
-	GLM_FUNC_QUALIFIER size_t hash<glm::mat<3, 2, T, Q>>::operator()(glm::mat<3, 2, T, Q> const& m) const
+	GLM_FUNC_QUALIFIER size_t hash<glm::mat<3, 2, T, Q>>::operator()(glm::mat<3, 2, T, Q> const& m) const GLM_NOEXCEPT
 	{
 		size_t seed = 0;
 		hash<glm::vec<2, T, Q>> hasher;
@@ -125,7 +125,7 @@ namespace std
 	}
 
 	template<typename T, glm::qualifier Q>
-	GLM_FUNC_QUALIFIER size_t hash<glm::mat<3, 3, T, Q>>::operator()(glm::mat<3, 3, T, Q> const& m) const
+	GLM_FUNC_QUALIFIER size_t hash<glm::mat<3, 3, T, Q>>::operator()(glm::mat<3, 3, T, Q> const& m) const GLM_NOEXCEPT
 	{
 		size_t seed = 0;
 		hash<glm::vec<3, T, Q>> hasher;
@@ -136,7 +136,7 @@ namespace std
 	}
 
 	template<typename T, glm::qualifier Q>
-	GLM_FUNC_QUALIFIER size_t hash<glm::mat<3, 4, T, Q>>::operator()(glm::mat<3, 4, T, Q> const& m) const
+	GLM_FUNC_QUALIFIER size_t hash<glm::mat<3, 4, T, Q>>::operator()(glm::mat<3, 4, T, Q> const& m) const GLM_NOEXCEPT
 	{
 		size_t seed = 0;
 		hash<glm::vec<4, T, Q>> hasher;
@@ -147,7 +147,7 @@ namespace std
 	}
 
 	template<typename T, glm::qualifier Q>
-	GLM_FUNC_QUALIFIER size_t hash<glm::mat<4, 2, T,Q>>::operator()(glm::mat<4, 2, T,Q> const& m) const
+	GLM_FUNC_QUALIFIER size_t hash<glm::mat<4, 2, T,Q>>::operator()(glm::mat<4, 2, T,Q> const& m) const GLM_NOEXCEPT
 	{
 		size_t seed = 0;
 		hash<glm::vec<2, T, Q>> hasher;
@@ -159,7 +159,7 @@ namespace std
 	}
 
 	template<typename T, glm::qualifier Q>
-	GLM_FUNC_QUALIFIER size_t hash<glm::mat<4, 3, T,Q>>::operator()(glm::mat<4, 3, T,Q> const& m) const
+	GLM_FUNC_QUALIFIER size_t hash<glm::mat<4, 3, T,Q>>::operator()(glm::mat<4, 3, T,Q> const& m) const GLM_NOEXCEPT
 	{
 		size_t seed = 0;
 		hash<glm::vec<3, T, Q>> hasher;
@@ -171,7 +171,7 @@ namespace std
 	}
 
 	template<typename T, glm::qualifier Q>
-	GLM_FUNC_QUALIFIER size_t hash<glm::mat<4, 4, T,Q>>::operator()(glm::mat<4, 4, T, Q> const& m) const
+	GLM_FUNC_QUALIFIER size_t hash<glm::mat<4, 4, T,Q>>::operator()(glm::mat<4, 4, T, Q> const& m) const GLM_NOEXCEPT
 	{
 		size_t seed = 0;
 		hash<glm::vec<4, T, Q>> hasher;

+ 1 - 0
test/gtx/CMakeLists.txt

@@ -18,6 +18,7 @@ glmCreateTestGTC(gtx_fast_trigonometry)
 glmCreateTestGTC(gtx_functions)
 glmCreateTestGTC(gtx_gradient_paint)
 glmCreateTestGTC(gtx_handed_coordinate_space)
+glmCreateTestGTC(gtx_hash)
 glmCreateTestGTC(gtx_integer)
 glmCreateTestGTC(gtx_intersect)
 glmCreateTestGTC(gtx_io)

+ 55 - 0
test/gtx/gtx_hash.cpp

@@ -0,0 +1,55 @@
+#define GLM_ENABLE_EXPERIMENTAL
+#include <glm/gtx/hash.hpp>
+#include <unordered_map>
+
+int test_compile()
+{
+	int Error = 0;
+
+    // Vector types
+    std::unordered_map<glm::vec1, int> map_vec1;
+    Error += ++map_vec1[glm::vec1(0.0f)];
+    std::unordered_map<glm::vec2, int> map_vec2;
+    Error += ++map_vec2[glm::vec2(0.0f)];
+    std::unordered_map<glm::vec3, int> map_vec3;
+    Error += ++map_vec3[glm::vec3(0.0f)];
+    std::unordered_map<glm::vec4, int> map_vec4;
+    Error += ++map_vec4[glm::vec4(0.0f)];
+
+    // Quaternion types
+    std::unordered_map<glm::quat, int> map_quat;
+    Error += ++map_quat[glm::quat(0.0f, glm::vec3(0.0f))];
+    std::unordered_map<glm::dualquat, int> map_dualquat;
+    Error += ++map_dualquat[glm::dualquat(glm::vec3(0.0f))];
+
+    // Matrix types
+    std::unordered_map<glm::mat2x2, int> map_mat2x2;
+    Error += ++map_mat2x2[glm::mat2x2(0.0f)];
+    std::unordered_map<glm::mat2x3, int> map_mat2x3;
+    Error += ++map_mat2x3[glm::mat2x3(0.0f)];
+    std::unordered_map<glm::mat2x4, int> map_mat2x4;
+    Error += ++map_mat2x4[glm::mat2x4(0.0f)];
+    std::unordered_map<glm::mat3x2, int> map_mat3x2;
+    Error += ++map_mat3x2[glm::mat3x2(0.0f)];
+    std::unordered_map<glm::mat3x3, int> map_mat3x3;
+    Error += ++map_mat3x3[glm::mat3x3(0.0f)];
+    std::unordered_map<glm::mat3x4, int> map_mat3x4;
+    Error += ++map_mat3x4[glm::mat3x4(0.0f)];
+    std::unordered_map<glm::mat4x2, int> map_mat4x2;
+    Error += ++map_mat4x2[glm::mat4x2(0.0f)];
+    std::unordered_map<glm::mat4x3, int> map_mat4x3;
+    Error += ++map_mat4x3[glm::mat4x3(0.0f)];
+    std::unordered_map<glm::mat4x4, int> map_mat4x4;
+    Error += ++map_mat4x4[glm::mat4x4(0.0f)];
+
+	return Error > 0 ? 0 : 1;
+}
+
+int main()
+{
+	int Error = 0;
+
+	Error += test_compile();
+
+	return Error;
+}