Fixed default initialization with vector and quaternion types using GLM_FORCE_CTOR_INIT #812

This commit is contained in:
Christophe Riccio
2018-09-10 15:45:01 +02:00
parent cf6504b65e
commit fe83040cbd
9 changed files with 143 additions and 11 deletions

View File

@@ -710,21 +710,22 @@ namespace detail
///////////////////////////////////////////////////////////////////////////////////
// Configure the use of defaulted initialized types
#define GLM_CTOR_INITIALIZER_LIST (1 << 1)
#define GLM_CTOR_INITIALISATION (1 << 2)
#define GLM_CTOR_INIT_DISABLE 0
#define GLM_CTOR_INITIALIZER_LIST 1
#define GLM_CTOR_INITIALISATION 2
#if defined(GLM_FORCE_CTOR_INIT) && GLM_HAS_INITIALIZER_LISTS
# define GLM_CONFIG_CTOR_INIT GLM_CTOR_INITIALIZER_LIST
#elif defined(GLM_FORCE_CTOR_INIT) && !GLM_HAS_INITIALIZER_LISTS
# define GLM_CONFIG_CTOR_INIT GLM_CTOR_INITIALISATION
#else
# define GLM_CONFIG_CTOR_INIT GLM_DISABLE
# define GLM_CONFIG_CTOR_INIT GLM_CTOR_INIT_DISABLE
#endif
///////////////////////////////////////////////////////////////////////////////////
// Configure the use of defaulted function
#if GLM_HAS_DEFAULTED_FUNCTIONS && GLM_CONFIG_CTOR_INIT == GLM_DISABLE
#if GLM_HAS_DEFAULTED_FUNCTIONS && GLM_CONFIG_CTOR_INIT == GLM_CTOR_INIT_DISABLE
# define GLM_CONFIG_DEFAULTED_FUNCTIONS GLM_ENABLE
# define GLM_DEFAULT = default
#else

View File

@@ -89,7 +89,7 @@ namespace detail
# if GLM_CONFIG_DEFAULTED_FUNCTIONS == GLM_DISABLE
template<typename T, qualifier Q>
GLM_FUNC_QUALIFIER GLM_CONSTEXPR qua<T, Q>::qua()
# if GLM_CONFIG_DEFAULTED_FUNCTIONS != GLM_DISABLE
# if GLM_CONFIG_CTOR_INIT != GLM_CTOR_INIT_DISABLE
: x(0), y(0), z(0), w(1)
# endif
{}

View File

@@ -9,7 +9,7 @@ namespace glm
# if GLM_CONFIG_DEFAULTED_FUNCTIONS == GLM_DISABLE
template<typename T, qualifier Q>
GLM_FUNC_QUALIFIER GLM_CONSTEXPR vec<1, T, Q>::vec()
# if GLM_CONFIG_DEFAULTED_FUNCTIONS != GLM_DISABLE
# if GLM_CONFIG_CTOR_INIT != GLM_CTOR_INIT_DISABLE
: x(0)
# endif
{}

View File

@@ -9,7 +9,7 @@ namespace glm
# if GLM_CONFIG_DEFAULTED_FUNCTIONS == GLM_DISABLE
template<typename T, qualifier Q>
GLM_FUNC_QUALIFIER GLM_CONSTEXPR vec<2, T, Q>::vec()
# if GLM_CONFIG_DEFAULTED_FUNCTIONS != GLM_DISABLE
# if GLM_CONFIG_CTOR_INIT != GLM_CTOR_INIT_DISABLE
: x(0), y(0)
# endif
{}

View File

@@ -9,7 +9,7 @@ namespace glm
# if GLM_CONFIG_DEFAULTED_FUNCTIONS == GLM_DISABLE
template<typename T, qualifier Q>
GLM_FUNC_QUALIFIER GLM_CONSTEXPR vec<3, T, Q>::vec()
# if GLM_CONFIG_DEFAULTED_FUNCTIONS != GLM_DISABLE
# if GLM_CONFIG_CTOR_INIT != GLM_CTOR_INIT_DISABLE
: x(0), y(0), z(0)
# endif
{}

View File

@@ -132,7 +132,7 @@ namespace detail
# if GLM_CONFIG_DEFAULTED_FUNCTIONS == GLM_DISABLE
template<typename T, qualifier Q>
GLM_FUNC_QUALIFIER GLM_CONSTEXPR vec<4, T, Q>::vec()
# if GLM_CONFIG_DEFAULTED_FUNCTIONS != GLM_DISABLE
# if GLM_CONFIG_CTOR_INIT != GLM_CTOR_INIT_DISABLE
: x(0), y(0), z(0), w(0)
# endif
{}