From 4e267b1b4f0808154a6f0547eca019a661ccb022 Mon Sep 17 00:00:00 2001 From: Christophe Riccio Date: Wed, 4 Jan 2017 23:56:47 +0100 Subject: [PATCH] Fixed Visual C++ internal error when declaring a global vec type with siwzzle expression enabled #594 --- glm/detail/setup.hpp | 18 +++++++++++------- glm/detail/type_vec1.hpp | 16 ++++++++-------- glm/detail/type_vec1.inl | 16 ++++++++-------- glm/detail/type_vec2.hpp | 20 ++++++++++---------- glm/detail/type_vec2.inl | 20 ++++++++++---------- glm/detail/type_vec3.hpp | 28 ++++++++++++++-------------- glm/detail/type_vec3.inl | 26 +++++++++++++------------- glm/detail/type_vec4.hpp | 24 ++++++++++++------------ glm/detail/type_vec4.inl | 24 ++++++++++++------------ readme.md | 1 + test/core/core_type_vec1.cpp | 3 +++ test/core/core_type_vec2.cpp | 4 ++++ test/core/core_type_vec3.cpp | 4 ++++ test/core/core_type_vec4.cpp | 4 ++++ 14 files changed, 114 insertions(+), 94 deletions(-) diff --git a/glm/detail/setup.hpp b/glm/detail/setup.hpp index 4b2aac63..9dbb4136 100644 --- a/glm/detail/setup.hpp +++ b/glm/detail/setup.hpp @@ -738,17 +738,21 @@ # define GLM_DEFAULT_CTOR #endif -#if GLM_HAS_CONSTEXPR +#if GLM_HAS_CONSTEXPR || GLM_HAS_CONSTEXPR_PARTIAL # define GLM_CONSTEXPR constexpr -# define GLM_CONSTEXPR_CTOR constexpr -# define GLM_RELAXED_CONSTEXPR constexpr -#elif GLM_HAS_CONSTEXPR_PARTIAL -# define GLM_CONSTEXPR constexpr -# define GLM_CONSTEXPR_CTOR -# define GLM_RELAXED_CONSTEXPR const +# if GLM_COMPILER & GLM_COMPILER_VC // Visual C++ has a bug #594 https://github.com/g-truc/glm/issues/594 +# define GLM_CONSTEXPR_CTOR +# else +# define GLM_CONSTEXPR_CTOR constexpr +# endif #else # define GLM_CONSTEXPR # define GLM_CONSTEXPR_CTOR +#endif + +#if GLM_HAS_CONSTEXPR +# define GLM_RELAXED_CONSTEXPR constexpr +#else # define GLM_RELAXED_CONSTEXPR const #endif diff --git a/glm/detail/type_vec1.hpp b/glm/detail/type_vec1.hpp index c84837b2..f5c7f017 100644 --- a/glm/detail/type_vec1.hpp +++ b/glm/detail/type_vec1.hpp @@ -85,31 +85,31 @@ namespace glm // -- Implicit basic constructors -- - GLM_FUNC_DECL GLM_CONSTEXPR tvec1() GLM_DEFAULT_CTOR; - GLM_FUNC_DECL GLM_CONSTEXPR tvec1(tvec1 const & v) GLM_DEFAULT; + GLM_FUNC_DECL GLM_CONSTEXPR_CTOR tvec1() GLM_DEFAULT_CTOR; + GLM_FUNC_DECL GLM_CONSTEXPR_CTOR tvec1(tvec1 const & v) GLM_DEFAULT; template - GLM_FUNC_DECL GLM_CONSTEXPR tvec1(tvec1 const & v); + GLM_FUNC_DECL GLM_CONSTEXPR_CTOR tvec1(tvec1 const & v); // -- Explicit basic constructors -- GLM_FUNC_DECL GLM_CONSTEXPR_CTOR explicit tvec1(ctor); - GLM_FUNC_DECL GLM_CONSTEXPR explicit tvec1(T scalar); + GLM_FUNC_DECL GLM_CONSTEXPR_CTOR explicit tvec1(T scalar); // -- Conversion vector constructors -- /// Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification) template - GLM_FUNC_DECL GLM_CONSTEXPR GLM_EXPLICIT tvec1(tvec2 const & v); + GLM_FUNC_DECL GLM_CONSTEXPR_CTOR GLM_EXPLICIT tvec1(tvec2 const & v); /// Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification) template - GLM_FUNC_DECL GLM_CONSTEXPR GLM_EXPLICIT tvec1(tvec3 const & v); + GLM_FUNC_DECL GLM_CONSTEXPR_CTOR GLM_EXPLICIT tvec1(tvec3 const & v); /// Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification) template - GLM_FUNC_DECL GLM_CONSTEXPR GLM_EXPLICIT tvec1(tvec4 const & v); + GLM_FUNC_DECL GLM_CONSTEXPR_CTOR GLM_EXPLICIT tvec1(tvec4 const & v); /// Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification) template - GLM_FUNC_DECL GLM_CONSTEXPR GLM_EXPLICIT tvec1(tvec1 const & v); + GLM_FUNC_DECL GLM_CONSTEXPR_CTOR GLM_EXPLICIT tvec1(tvec1 const & v); // -- Swizzle constructors -- /* diff --git a/glm/detail/type_vec1.inl b/glm/detail/type_vec1.inl index 3c872958..72f94376 100644 --- a/glm/detail/type_vec1.inl +++ b/glm/detail/type_vec1.inl @@ -7,7 +7,7 @@ namespace glm # if !GLM_HAS_DEFAULTED_FUNCTIONS || !defined(GLM_FORCE_NO_CTOR_INIT) template - GLM_FUNC_QUALIFIER GLM_CONSTEXPR tvec1::tvec1() + GLM_FUNC_QUALIFIER GLM_CONSTEXPR_CTOR tvec1::tvec1() # ifndef GLM_FORCE_NO_CTOR_INIT : x(0) # endif @@ -16,14 +16,14 @@ namespace glm # if !GLM_HAS_DEFAULTED_FUNCTIONS template - GLM_FUNC_QUALIFIER GLM_CONSTEXPR tvec1::tvec1(tvec1 const & v) + GLM_FUNC_QUALIFIER GLM_CONSTEXPR_CTOR tvec1::tvec1(tvec1 const & v) : x(v.x) {} # endif//!GLM_HAS_DEFAULTED_FUNCTIONS template template - GLM_FUNC_QUALIFIER GLM_CONSTEXPR tvec1::tvec1(tvec1 const & v) + GLM_FUNC_QUALIFIER GLM_CONSTEXPR_CTOR tvec1::tvec1(tvec1 const & v) : x(v.x) {} @@ -34,7 +34,7 @@ namespace glm {} template - GLM_FUNC_QUALIFIER GLM_CONSTEXPR tvec1::tvec1(T scalar) + GLM_FUNC_QUALIFIER GLM_CONSTEXPR_CTOR tvec1::tvec1(T scalar) : x(scalar) {} @@ -42,25 +42,25 @@ namespace glm template template - GLM_FUNC_QUALIFIER GLM_CONSTEXPR tvec1::tvec1(tvec1 const & v) + GLM_FUNC_QUALIFIER GLM_CONSTEXPR_CTOR tvec1::tvec1(tvec1 const & v) : x(static_cast(v.x)) {} template template - GLM_FUNC_QUALIFIER GLM_CONSTEXPR tvec1::tvec1(tvec2 const & v) + GLM_FUNC_QUALIFIER GLM_CONSTEXPR_CTOR tvec1::tvec1(tvec2 const & v) : x(static_cast(v.x)) {} template template - GLM_FUNC_QUALIFIER GLM_CONSTEXPR tvec1::tvec1(tvec3 const & v) + GLM_FUNC_QUALIFIER GLM_CONSTEXPR_CTOR tvec1::tvec1(tvec3 const & v) : x(static_cast(v.x)) {} template template - GLM_FUNC_QUALIFIER GLM_CONSTEXPR tvec1::tvec1(tvec4 const & v) + GLM_FUNC_QUALIFIER GLM_CONSTEXPR_CTOR tvec1::tvec1(tvec4 const & v) : x(static_cast(v.x)) {} diff --git a/glm/detail/type_vec2.hpp b/glm/detail/type_vec2.hpp index 16349203..a9af32e3 100644 --- a/glm/detail/type_vec2.hpp +++ b/glm/detail/type_vec2.hpp @@ -86,37 +86,37 @@ namespace glm // -- Implicit basic constructors -- - GLM_FUNC_DECL GLM_CONSTEXPR tvec2() GLM_DEFAULT_CTOR; - GLM_FUNC_DECL GLM_CONSTEXPR tvec2(tvec2 const& v) GLM_DEFAULT; + GLM_FUNC_DECL GLM_CONSTEXPR_CTOR tvec2() GLM_DEFAULT_CTOR; + GLM_FUNC_DECL GLM_CONSTEXPR_CTOR tvec2(tvec2 const& v) GLM_DEFAULT; template - GLM_FUNC_DECL GLM_CONSTEXPR tvec2(tvec2 const& v); + GLM_FUNC_DECL GLM_CONSTEXPR_CTOR tvec2(tvec2 const& v); // -- 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 tvec2(T s1, T s2); + GLM_FUNC_DECL GLM_CONSTEXPR_CTOR explicit tvec2(T scalar); + GLM_FUNC_DECL GLM_CONSTEXPR_CTOR tvec2(T s1, T s2); // -- Conversion constructors -- /// Explicit converions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification) template - GLM_FUNC_DECL GLM_CONSTEXPR tvec2(A x, B y); + GLM_FUNC_DECL GLM_CONSTEXPR_CTOR tvec2(A x, B y); template - GLM_FUNC_DECL GLM_CONSTEXPR tvec2(tvec1 const & v1, tvec1 const & v2); + GLM_FUNC_DECL GLM_CONSTEXPR_CTOR tvec2(tvec1 const & v1, tvec1 const & v2); // -- Conversion vector constructors -- /// Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification) template - GLM_FUNC_DECL GLM_CONSTEXPR GLM_EXPLICIT tvec2(tvec3 const & v); + GLM_FUNC_DECL GLM_CONSTEXPR_CTOR GLM_EXPLICIT tvec2(tvec3 const & v); /// Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification) template - GLM_FUNC_DECL GLM_CONSTEXPR GLM_EXPLICIT tvec2(tvec4 const & v); + GLM_FUNC_DECL GLM_CONSTEXPR_CTOR GLM_EXPLICIT tvec2(tvec4 const & v); /// Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification) template - GLM_FUNC_DECL GLM_CONSTEXPR GLM_EXPLICIT tvec2(tvec2 const & v); + GLM_FUNC_DECL GLM_CONSTEXPR_CTOR GLM_EXPLICIT tvec2(tvec2 const & v); // -- Swizzle constructors -- # if GLM_HAS_UNRESTRICTED_UNIONS && (GLM_SWIZZLE == GLM_SWIZZLE_ENABLED) diff --git a/glm/detail/type_vec2.inl b/glm/detail/type_vec2.inl index ae372541..cf79da24 100644 --- a/glm/detail/type_vec2.inl +++ b/glm/detail/type_vec2.inl @@ -20,7 +20,7 @@ namespace glm # if !GLM_HAS_DEFAULTED_FUNCTIONS || !defined(GLM_FORCE_NO_CTOR_INIT) template - GLM_FUNC_QUALIFIER GLM_CONSTEXPR tvec2::tvec2() + GLM_FUNC_QUALIFIER GLM_CONSTEXPR_CTOR tvec2::tvec2() # ifndef GLM_FORCE_NO_CTOR_INIT : x(0), y(0) # endif @@ -29,14 +29,14 @@ namespace glm # if !GLM_HAS_DEFAULTED_FUNCTIONS template - GLM_FUNC_QUALIFIER GLM_CONSTEXPR tvec2::tvec2(tvec2 const & v) + GLM_FUNC_QUALIFIER GLM_CONSTEXPR_CTOR tvec2::tvec2(tvec2 const & v) : x(v.x), y(v.y) {} # endif//!GLM_HAS_DEFAULTED_FUNCTIONS template template - GLM_FUNC_QUALIFIER GLM_CONSTEXPR tvec2::tvec2(tvec2 const & v) + GLM_FUNC_QUALIFIER GLM_CONSTEXPR_CTOR tvec2::tvec2(tvec2 const & v) : x(v.x), y(v.y) {} @@ -47,12 +47,12 @@ namespace glm {} template - GLM_FUNC_QUALIFIER GLM_CONSTEXPR tvec2::tvec2(T scalar) + GLM_FUNC_QUALIFIER GLM_CONSTEXPR_CTOR tvec2::tvec2(T scalar) : x(scalar), y(scalar) {} template - GLM_FUNC_QUALIFIER GLM_CONSTEXPR tvec2::tvec2(T s1, T s2) + GLM_FUNC_QUALIFIER GLM_CONSTEXPR_CTOR tvec2::tvec2(T s1, T s2) : x(s1), y(s2) {} @@ -60,14 +60,14 @@ namespace glm template template - GLM_FUNC_QUALIFIER GLM_CONSTEXPR tvec2::tvec2(A a, B b) + GLM_FUNC_QUALIFIER GLM_CONSTEXPR_CTOR tvec2::tvec2(A a, B b) : x(static_cast(a)) , y(static_cast(b)) {} template template - GLM_FUNC_QUALIFIER GLM_CONSTEXPR tvec2::tvec2(tvec1 const & a, tvec1 const & b) + GLM_FUNC_QUALIFIER GLM_CONSTEXPR_CTOR tvec2::tvec2(tvec1 const & a, tvec1 const & b) : x(static_cast(a.x)) , y(static_cast(b.x)) {} @@ -76,21 +76,21 @@ namespace glm template template - GLM_FUNC_QUALIFIER GLM_CONSTEXPR tvec2::tvec2(tvec2 const & v) + GLM_FUNC_QUALIFIER GLM_CONSTEXPR_CTOR tvec2::tvec2(tvec2 const & v) : x(static_cast(v.x)) , y(static_cast(v.y)) {} template template - GLM_FUNC_QUALIFIER GLM_CONSTEXPR tvec2::tvec2(tvec3 const & v) + GLM_FUNC_QUALIFIER GLM_CONSTEXPR_CTOR tvec2::tvec2(tvec3 const & v) : x(static_cast(v.x)) , y(static_cast(v.y)) {} template template - GLM_FUNC_QUALIFIER GLM_CONSTEXPR tvec2::tvec2(tvec4 const & v) + GLM_FUNC_QUALIFIER GLM_CONSTEXPR_CTOR tvec2::tvec2(tvec4 const & v) : x(static_cast(v.x)) , y(static_cast(v.y)) {} diff --git a/glm/detail/type_vec3.hpp b/glm/detail/type_vec3.hpp index be133c98..f85f0a5c 100644 --- a/glm/detail/type_vec3.hpp +++ b/glm/detail/type_vec3.hpp @@ -86,46 +86,46 @@ namespace glm // -- Implicit basic constructors -- - GLM_FUNC_DECL GLM_CONSTEXPR tvec3() GLM_DEFAULT_CTOR; - GLM_FUNC_DECL GLM_CONSTEXPR tvec3(tvec3 const & v) GLM_DEFAULT; + GLM_FUNC_DECL GLM_CONSTEXPR_CTOR tvec3() GLM_DEFAULT_CTOR; + GLM_FUNC_DECL GLM_CONSTEXPR_CTOR tvec3(tvec3 const & v) GLM_DEFAULT; template - GLM_FUNC_DECL GLM_CONSTEXPR tvec3(tvec3 const & v); + GLM_FUNC_DECL GLM_CONSTEXPR_CTOR tvec3(tvec3 const & v); // -- 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 tvec3(T a, T b, T c); + GLM_FUNC_DECL GLM_CONSTEXPR_CTOR explicit tvec3(T scalar); + GLM_FUNC_DECL GLM_CONSTEXPR_CTOR tvec3(T a, T b, T c); // -- Conversion scalar constructors -- - /// Explicit converions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification) + /// Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification) template - GLM_FUNC_DECL GLM_CONSTEXPR tvec3(A a, B b, C c); + GLM_FUNC_DECL GLM_CONSTEXPR_CTOR tvec3(A a, B b, C c); template - GLM_FUNC_DECL GLM_CONSTEXPR tvec3(tvec1 const & a, tvec1 const & b, tvec1 const & c); + GLM_FUNC_DECL GLM_CONSTEXPR_CTOR tvec3(tvec1 const & a, tvec1 const & b, tvec1 const & c); // -- Conversion vector constructors -- /// Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification) template - GLM_FUNC_DECL GLM_CONSTEXPR tvec3(tvec2 const & a, B b); + GLM_FUNC_DECL GLM_CONSTEXPR_CTOR tvec3(tvec2 const & a, B b); /// Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification) template - GLM_FUNC_DECL GLM_CONSTEXPR tvec3(tvec2 const & a, tvec1 const & b); + GLM_FUNC_DECL GLM_CONSTEXPR_CTOR tvec3(tvec2 const & a, tvec1 const & b); /// Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification) template - GLM_FUNC_DECL GLM_CONSTEXPR tvec3(A a, tvec2 const & b); + GLM_FUNC_DECL GLM_CONSTEXPR_CTOR tvec3(A a, tvec2 const & b); /// Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification) template - GLM_FUNC_DECL GLM_CONSTEXPR tvec3(tvec1 const & a, tvec2 const & b); + GLM_FUNC_DECL GLM_CONSTEXPR_CTOR tvec3(tvec1 const & a, tvec2 const & b); /// Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification) template - GLM_FUNC_DECL GLM_CONSTEXPR GLM_EXPLICIT tvec3(tvec4 const & v); + GLM_FUNC_DECL GLM_CONSTEXPR_CTOR GLM_EXPLICIT tvec3(tvec4 const & v); /// Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification) template - GLM_FUNC_DECL GLM_CONSTEXPR GLM_EXPLICIT tvec3(tvec3 const & v); + GLM_FUNC_DECL GLM_CONSTEXPR_CTOR GLM_EXPLICIT tvec3(tvec3 const & v); // -- Swizzle constructors -- # if GLM_HAS_UNRESTRICTED_UNIONS && (GLM_SWIZZLE == GLM_SWIZZLE_ENABLED) diff --git a/glm/detail/type_vec3.inl b/glm/detail/type_vec3.inl index df9b2ad7..d84299d4 100644 --- a/glm/detail/type_vec3.inl +++ b/glm/detail/type_vec3.inl @@ -33,7 +33,7 @@ namespace glm # if !GLM_HAS_DEFAULTED_FUNCTIONS || !defined(GLM_FORCE_NO_CTOR_INIT) template - GLM_FUNC_QUALIFIER GLM_CONSTEXPR tvec3::tvec3() + GLM_FUNC_QUALIFIER GLM_CONSTEXPR_CTOR tvec3::tvec3() # ifndef GLM_FORCE_NO_CTOR_INIT : x(0), y(0), z(0) # endif @@ -42,14 +42,14 @@ namespace glm # if !GLM_HAS_DEFAULTED_FUNCTIONS template - GLM_FUNC_QUALIFIER GLM_CONSTEXPR tvec3::tvec3(tvec3 const & v) + GLM_FUNC_QUALIFIER GLM_CONSTEXPR_CTOR tvec3::tvec3(tvec3 const & v) : x(v.x), y(v.y), z(v.z) {} # endif//!GLM_HAS_DEFAULTED_FUNCTIONS template template - GLM_FUNC_QUALIFIER GLM_CONSTEXPR tvec3::tvec3(tvec3 const & v) + GLM_FUNC_QUALIFIER GLM_CONSTEXPR_CTOR tvec3::tvec3(tvec3 const & v) : x(v.x), y(v.y), z(v.z) {} @@ -60,12 +60,12 @@ namespace glm {} template - GLM_FUNC_QUALIFIER GLM_CONSTEXPR tvec3::tvec3(T scalar) + GLM_FUNC_QUALIFIER GLM_CONSTEXPR_CTOR tvec3::tvec3(T scalar) : x(scalar), y(scalar), z(scalar) {} template - GLM_FUNC_QUALIFIER GLM_CONSTEXPR tvec3::tvec3(T a, T b, T c) + GLM_FUNC_QUALIFIER GLM_CONSTEXPR_CTOR tvec3::tvec3(T a, T b, T c) : x(a), y(b), z(c) {} @@ -73,7 +73,7 @@ namespace glm template template - GLM_FUNC_QUALIFIER GLM_CONSTEXPR tvec3::tvec3(A a, B b, C c) : + GLM_FUNC_QUALIFIER GLM_CONSTEXPR_CTOR tvec3::tvec3(A a, B b, C c) : x(static_cast(a)), y(static_cast(b)), z(static_cast(c)) @@ -81,7 +81,7 @@ namespace glm template template - GLM_FUNC_QUALIFIER GLM_CONSTEXPR tvec3::tvec3(tvec1 const & a, tvec1 const & b, tvec1 const & c) : + GLM_FUNC_QUALIFIER GLM_CONSTEXPR_CTOR tvec3::tvec3(tvec1 const & a, tvec1 const & b, tvec1 const & c) : x(static_cast(a)), y(static_cast(b)), z(static_cast(c)) @@ -91,7 +91,7 @@ namespace glm template template - GLM_FUNC_QUALIFIER GLM_CONSTEXPR tvec3::tvec3(tvec2 const & a, B b) : + GLM_FUNC_QUALIFIER GLM_CONSTEXPR_CTOR tvec3::tvec3(tvec2 const & a, B b) : x(static_cast(a.x)), y(static_cast(a.y)), z(static_cast(b)) @@ -99,7 +99,7 @@ namespace glm template template - GLM_FUNC_QUALIFIER GLM_CONSTEXPR tvec3::tvec3(tvec2 const & a, tvec1 const & b) : + GLM_FUNC_QUALIFIER GLM_CONSTEXPR_CTOR tvec3::tvec3(tvec2 const & a, tvec1 const & b) : x(static_cast(a.x)), y(static_cast(a.y)), z(static_cast(b.x)) @@ -107,7 +107,7 @@ namespace glm template template - GLM_FUNC_QUALIFIER GLM_CONSTEXPR tvec3::tvec3(A a, tvec2 const & b) : + GLM_FUNC_QUALIFIER GLM_CONSTEXPR_CTOR tvec3::tvec3(A a, tvec2 const & b) : x(static_cast(a)), y(static_cast(b.x)), z(static_cast(b.y)) @@ -115,7 +115,7 @@ namespace glm template template - GLM_FUNC_QUALIFIER GLM_CONSTEXPR tvec3::tvec3(tvec1 const & a, tvec2 const & b) : + GLM_FUNC_QUALIFIER GLM_CONSTEXPR_CTOR tvec3::tvec3(tvec1 const & a, tvec2 const & b) : x(static_cast(a.x)), y(static_cast(b.x)), z(static_cast(b.y)) @@ -123,7 +123,7 @@ namespace glm template template - GLM_FUNC_QUALIFIER GLM_CONSTEXPR tvec3::tvec3(tvec3 const & v) : + GLM_FUNC_QUALIFIER GLM_CONSTEXPR_CTOR tvec3::tvec3(tvec3 const & v) : x(static_cast(v.x)), y(static_cast(v.y)), z(static_cast(v.z)) @@ -131,7 +131,7 @@ namespace glm template template - GLM_FUNC_QUALIFIER GLM_CONSTEXPR tvec3::tvec3(tvec4 const & v) : + GLM_FUNC_QUALIFIER GLM_CONSTEXPR_CTOR tvec3::tvec3(tvec4 const & v) : x(static_cast(v.x)), y(static_cast(v.y)), z(static_cast(v.z)) diff --git a/glm/detail/type_vec4.hpp b/glm/detail/type_vec4.hpp index 5538a919..5e89b744 100644 --- a/glm/detail/type_vec4.hpp +++ b/glm/detail/type_vec4.hpp @@ -112,41 +112,41 @@ namespace glm /// Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification) template - GLM_FUNC_DECL GLM_CONSTEXPR tvec4(tvec2 const & a, B b, C c); + GLM_FUNC_DECL GLM_CONSTEXPR_CTOR tvec4(tvec2 const & a, B b, C c); /// Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification) template - GLM_FUNC_DECL GLM_CONSTEXPR tvec4(tvec2 const & a, tvec1 const & b, tvec1 const & c); + GLM_FUNC_DECL GLM_CONSTEXPR_CTOR tvec4(tvec2 const & a, tvec1 const & b, tvec1 const & c); /// Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification) template - GLM_FUNC_DECL GLM_CONSTEXPR tvec4(A a, tvec2 const & b, C c); + GLM_FUNC_DECL GLM_CONSTEXPR_CTOR tvec4(A a, tvec2 const & b, C c); /// Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification) template - GLM_FUNC_DECL GLM_CONSTEXPR tvec4(tvec1 const & a, tvec2 const & b, tvec1 const & c); + GLM_FUNC_DECL GLM_CONSTEXPR_CTOR tvec4(tvec1 const & a, tvec2 const & b, tvec1 const & c); /// Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification) template - GLM_FUNC_DECL GLM_CONSTEXPR tvec4(A a, B b, tvec2 const & c); + GLM_FUNC_DECL GLM_CONSTEXPR_CTOR tvec4(A a, B b, tvec2 const & c); /// Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification) template - GLM_FUNC_DECL GLM_CONSTEXPR tvec4(tvec1 const & a, tvec1 const & b, tvec2 const & c); + GLM_FUNC_DECL GLM_CONSTEXPR_CTOR tvec4(tvec1 const & a, tvec1 const & b, tvec2 const & c); /// Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification) template - GLM_FUNC_DECL GLM_CONSTEXPR tvec4(tvec3 const & a, B b); + GLM_FUNC_DECL GLM_CONSTEXPR_CTOR tvec4(tvec3 const & a, B b); /// Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification) template - GLM_FUNC_DECL GLM_CONSTEXPR tvec4(tvec3 const & a, tvec1 const & b); + GLM_FUNC_DECL GLM_CONSTEXPR_CTOR tvec4(tvec3 const & a, tvec1 const & b); /// Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification) template - GLM_FUNC_DECL GLM_CONSTEXPR tvec4(A a, tvec3 const & b); + GLM_FUNC_DECL GLM_CONSTEXPR_CTOR tvec4(A a, tvec3 const & b); /// Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification) template - GLM_FUNC_DECL GLM_CONSTEXPR tvec4(tvec1 const & a, tvec3 const & b); + GLM_FUNC_DECL GLM_CONSTEXPR_CTOR tvec4(tvec1 const & a, tvec3 const & b); /// Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification) template - GLM_FUNC_DECL GLM_CONSTEXPR tvec4(tvec2 const & a, tvec2 const & b); + GLM_FUNC_DECL GLM_CONSTEXPR_CTOR tvec4(tvec2 const & a, tvec2 const & b); /// Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification) template - GLM_FUNC_DECL GLM_CONSTEXPR GLM_EXPLICIT tvec4(tvec4 const& v); + GLM_FUNC_DECL GLM_CONSTEXPR_CTOR GLM_EXPLICIT tvec4(tvec4 const& v); // -- Swizzle constructors -- # if GLM_HAS_UNRESTRICTED_UNIONS && (GLM_SWIZZLE == GLM_SWIZZLE_ENABLED) diff --git a/glm/detail/type_vec4.inl b/glm/detail/type_vec4.inl index 2377e2b1..b10a6621 100644 --- a/glm/detail/type_vec4.inl +++ b/glm/detail/type_vec4.inl @@ -216,7 +216,7 @@ namespace detail template template - GLM_FUNC_QUALIFIER GLM_CONSTEXPR tvec4::tvec4(tvec2 const & a, B b, C c) : + GLM_FUNC_QUALIFIER GLM_CONSTEXPR_CTOR tvec4::tvec4(tvec2 const & a, B b, C c) : x(static_cast(a.x)), y(static_cast(a.y)), z(static_cast(b)), @@ -225,7 +225,7 @@ namespace detail template template - GLM_FUNC_QUALIFIER GLM_CONSTEXPR tvec4::tvec4(tvec2 const & a, tvec1 const & b, tvec1 const & c) : + GLM_FUNC_QUALIFIER GLM_CONSTEXPR_CTOR tvec4::tvec4(tvec2 const & a, tvec1 const & b, tvec1 const & c) : x(static_cast(a.x)), y(static_cast(a.y)), z(static_cast(b.x)), @@ -234,7 +234,7 @@ namespace detail template template - GLM_FUNC_QUALIFIER GLM_CONSTEXPR tvec4::tvec4(A s1, tvec2 const & v, C s2) : + GLM_FUNC_QUALIFIER GLM_CONSTEXPR_CTOR tvec4::tvec4(A s1, tvec2 const & v, C s2) : x(static_cast(s1)), y(static_cast(v.x)), z(static_cast(v.y)), @@ -243,7 +243,7 @@ namespace detail template template - GLM_FUNC_QUALIFIER GLM_CONSTEXPR tvec4::tvec4(tvec1 const & a, tvec2 const & b, tvec1 const & c) : + GLM_FUNC_QUALIFIER GLM_CONSTEXPR_CTOR tvec4::tvec4(tvec1 const & a, tvec2 const & b, tvec1 const & c) : x(static_cast(a.x)), y(static_cast(b.x)), z(static_cast(b.y)), @@ -252,7 +252,7 @@ namespace detail template template - GLM_FUNC_QUALIFIER GLM_CONSTEXPR tvec4::tvec4(A s1, B s2, tvec2 const & v) : + GLM_FUNC_QUALIFIER GLM_CONSTEXPR_CTOR tvec4::tvec4(A s1, B s2, tvec2 const & v) : x(static_cast(s1)), y(static_cast(s2)), z(static_cast(v.x)), @@ -261,7 +261,7 @@ namespace detail template template - GLM_FUNC_QUALIFIER GLM_CONSTEXPR tvec4::tvec4(tvec1 const & a, tvec1 const & b, tvec2 const & c) : + GLM_FUNC_QUALIFIER GLM_CONSTEXPR_CTOR tvec4::tvec4(tvec1 const & a, tvec1 const & b, tvec2 const & c) : x(static_cast(a.x)), y(static_cast(b.x)), z(static_cast(c.x)), @@ -270,7 +270,7 @@ namespace detail template template - GLM_FUNC_QUALIFIER GLM_CONSTEXPR tvec4::tvec4(tvec3 const & a, B b) : + GLM_FUNC_QUALIFIER GLM_CONSTEXPR_CTOR tvec4::tvec4(tvec3 const & a, B b) : x(static_cast(a.x)), y(static_cast(a.y)), z(static_cast(a.z)), @@ -279,7 +279,7 @@ namespace detail template template - GLM_FUNC_QUALIFIER GLM_CONSTEXPR tvec4::tvec4(tvec3 const & a, tvec1 const & b) : + GLM_FUNC_QUALIFIER GLM_CONSTEXPR_CTOR tvec4::tvec4(tvec3 const & a, tvec1 const & b) : x(static_cast(a.x)), y(static_cast(a.y)), z(static_cast(a.z)), @@ -288,7 +288,7 @@ namespace detail template template - GLM_FUNC_QUALIFIER GLM_CONSTEXPR tvec4::tvec4(A a, tvec3 const & b) : + GLM_FUNC_QUALIFIER GLM_CONSTEXPR_CTOR tvec4::tvec4(A a, tvec3 const & b) : x(static_cast(a)), y(static_cast(b.x)), z(static_cast(b.y)), @@ -297,7 +297,7 @@ namespace detail template template - GLM_FUNC_QUALIFIER GLM_CONSTEXPR tvec4::tvec4(tvec1 const & a, tvec3 const & b) : + GLM_FUNC_QUALIFIER GLM_CONSTEXPR_CTOR tvec4::tvec4(tvec1 const & a, tvec3 const & b) : x(static_cast(a.x)), y(static_cast(b.x)), z(static_cast(b.y)), @@ -306,7 +306,7 @@ namespace detail template template - GLM_FUNC_QUALIFIER GLM_CONSTEXPR tvec4::tvec4(tvec2 const & a, tvec2 const & b) : + GLM_FUNC_QUALIFIER GLM_CONSTEXPR_CTOR tvec4::tvec4(tvec2 const & a, tvec2 const & b) : x(static_cast(a.x)), y(static_cast(a.y)), z(static_cast(b.x)), @@ -315,7 +315,7 @@ namespace detail template template - GLM_FUNC_QUALIFIER GLM_CONSTEXPR tvec4::tvec4(tvec4 const & v) : + GLM_FUNC_QUALIFIER GLM_CONSTEXPR_CTOR tvec4::tvec4(tvec4 const & v) : x(static_cast(v.x)), y(static_cast(v.y)), z(static_cast(v.z)), diff --git a/readme.md b/readme.md index 96d8a5e8..93a0d651 100644 --- a/readme.md +++ b/readme.md @@ -59,6 +59,7 @@ glm::mat4 camera(float Translate, glm::vec2 const & Rotate) - Fixed GCC 6.2 compiler warnings #580 - Fixed GTX_matrix_decompose decompose #582 #448 - Fixed GCC 4.5 and older build #566 +- Fixed Visual C++ internal error when declaring a global vec type with siwzzle expression enabled #594 #### [GLM 0.9.8.3](https://github.com/g-truc/glm/releases/tag/0.9.8.3) - 2016-11-12 ##### Improvements: diff --git a/test/core/core_type_vec1.cpp b/test/core/core_type_vec1.cpp index b03057aa..ff1555fe 100644 --- a/test/core/core_type_vec1.cpp +++ b/test/core/core_type_vec1.cpp @@ -3,6 +3,9 @@ #include #include +static glm::vec1 v1; +static glm::vec1 v2(1); + int test_vec1_operators() { int Error(0); diff --git a/test/core/core_type_vec2.cpp b/test/core/core_type_vec2.cpp index 97c7f9b1..89ab00cb 100644 --- a/test/core/core_type_vec2.cpp +++ b/test/core/core_type_vec2.cpp @@ -6,6 +6,10 @@ # include #endif +static glm::vec2 v1; +static glm::vec2 v2(1); +static glm::vec2 v3(1, 1); + int test_vec2_operators() { int Error = 0; diff --git a/test/core/core_type_vec3.cpp b/test/core/core_type_vec3.cpp index cb27a327..072767f9 100644 --- a/test/core/core_type_vec3.cpp +++ b/test/core/core_type_vec3.cpp @@ -7,6 +7,10 @@ #include #include +static glm::vec3 v1; +static glm::vec3 v2(1); +static glm::vec3 v3(1, 1, 1); + int test_vec3_ctor() { int Error = 0; diff --git a/test/core/core_type_vec4.cpp b/test/core/core_type_vec4.cpp index 9ada8878..72af25d8 100644 --- a/test/core/core_type_vec4.cpp +++ b/test/core/core_type_vec4.cpp @@ -8,6 +8,10 @@ #include #include +static glm::vec4 v1; +static glm::vec4 v2(1); +static glm::vec4 v3(1, 1, 1, 1); + template struct mask {