Use constexpr only with C++14 compiler
This commit is contained in:
@@ -10,7 +10,7 @@ struct _swizzle
|
||||
|
||||
struct vec2
|
||||
{
|
||||
GLM_CONSTEXPR_CXX11 vec2() :
|
||||
GLM_CONSTEXPR vec2() :
|
||||
x(0), y(0)
|
||||
{}
|
||||
|
||||
|
||||
@@ -1291,13 +1291,13 @@ namespace ldexp_
|
||||
|
||||
static int test_constexpr()
|
||||
{
|
||||
#if GLM_HAS_CONSTEXPR_CXX14
|
||||
#if GLM_HAS_CONSTEXPR
|
||||
static_assert(glm::abs(1.0f) > 0.0f, "GLM: Failed constexpr");
|
||||
static_assert(glm::abs(glm::vec1(1.0f)) != glm::vec1(0.0f), "GLM: Failed constexpr");
|
||||
static_assert(glm::abs(glm::vec2(1.0f)) != glm::vec2(0.0f), "GLM: Failed constexpr");
|
||||
static_assert(glm::abs(glm::vec3(1.0f)) != glm::vec3(0.0f), "GLM: Failed constexpr");
|
||||
static_assert(glm::abs(glm::vec4(1.0f)) != glm::vec4(0.0f), "GLM: Failed constexpr");
|
||||
#endif // GLM_HAS_CONSTEXPR_CXX14
|
||||
#endif // GLM_HAS_CONSTEXPR
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -157,7 +157,7 @@ int test_size()
|
||||
|
||||
int test_constexpr()
|
||||
{
|
||||
#if GLM_HAS_CONSTEXPR_CXX14
|
||||
#if GLM_HAS_CONSTEXPR
|
||||
static_assert(glm::mat2x2::length() == 2, "GLM: Failed constexpr");
|
||||
#endif
|
||||
|
||||
|
||||
@@ -122,7 +122,7 @@ int test_size()
|
||||
|
||||
int test_constexpr()
|
||||
{
|
||||
#if GLM_HAS_CONSTEXPR_CXX14
|
||||
#if GLM_HAS_CONSTEXPR
|
||||
static_assert(glm::mat2x3::length() == 2, "GLM: Failed constexpr");
|
||||
#endif
|
||||
|
||||
|
||||
@@ -124,7 +124,7 @@ static int test_size()
|
||||
|
||||
static int test_constexpr()
|
||||
{
|
||||
#if GLM_HAS_CONSTEXPR_CXX14
|
||||
#if GLM_HAS_CONSTEXPR
|
||||
static_assert(glm::mat2x4::length() == 2, "GLM: Failed constexpr");
|
||||
#endif
|
||||
|
||||
|
||||
@@ -126,7 +126,7 @@ static int test_size()
|
||||
|
||||
static int test_constexpr()
|
||||
{
|
||||
#if GLM_HAS_CONSTEXPR_CXX14
|
||||
#if GLM_HAS_CONSTEXPR
|
||||
static_assert(glm::mat3x2::length() == 3, "GLM: Failed constexpr");
|
||||
#endif
|
||||
|
||||
|
||||
@@ -185,10 +185,10 @@ static int test_size()
|
||||
|
||||
static int test_constexpr()
|
||||
{
|
||||
#if GLM_HAS_CONSTEXPR_CXX14
|
||||
#if GLM_HAS_CONSTEXPR
|
||||
static_assert(glm::mat3x3::length() == 3, "GLM: Failed constexpr");
|
||||
|
||||
GLM_CONSTEXPR_CXX11 glm::mat3x3 const Z(0.0f);
|
||||
GLM_CONSTEXPR glm::mat3x3 const Z(0.0f);
|
||||
static_assert(Z[0] == glm::vec3(0.0f), "GLM: Failed constexpr");
|
||||
static_assert(Z == glm::mat3x3(0.0f), "GLM: Failed constexpr");
|
||||
#endif
|
||||
|
||||
@@ -128,7 +128,7 @@ static int test_size()
|
||||
|
||||
static int test_constexpr()
|
||||
{
|
||||
#if GLM_HAS_CONSTEXPR_CXX14
|
||||
#if GLM_HAS_CONSTEXPR
|
||||
static_assert(glm::mat3x4::length() == 3, "GLM: Failed constexpr");
|
||||
#endif
|
||||
|
||||
|
||||
@@ -130,7 +130,7 @@ static int test_size()
|
||||
|
||||
static int test_constexpr()
|
||||
{
|
||||
#if GLM_HAS_CONSTEXPR_CXX14
|
||||
#if GLM_HAS_CONSTEXPR
|
||||
static_assert(glm::mat4x2::length() == 4, "GLM: Failed constexpr");
|
||||
#endif
|
||||
|
||||
|
||||
@@ -130,7 +130,7 @@ static int test_size()
|
||||
|
||||
static int test_constexpr()
|
||||
{
|
||||
#if GLM_HAS_CONSTEXPR_CXX14
|
||||
#if GLM_HAS_CONSTEXPR
|
||||
static_assert(glm::mat4x3::length() == 4, "GLM: Failed constexpr");
|
||||
#endif
|
||||
|
||||
|
||||
@@ -323,7 +323,7 @@ static int test_constexpr()
|
||||
{
|
||||
glm::mat4 const I(1.0f);
|
||||
|
||||
#if GLM_HAS_CONSTEXPR_CXX14
|
||||
#if GLM_HAS_CONSTEXPR
|
||||
static_assert(glm::mat4::length() == 4, "GLM: Failed constexpr");
|
||||
#endif
|
||||
|
||||
|
||||
@@ -145,7 +145,7 @@ static int test_swizzle()
|
||||
|
||||
static int test_constexpr()
|
||||
{
|
||||
#if GLM_HAS_CONSTEXPR_CXX14
|
||||
#if GLM_HAS_CONSTEXPR
|
||||
static_assert(glm::vec1::length() == 1, "GLM: Failed constexpr");
|
||||
static_assert(glm::vec1(1.0f).x > 0.0f, "GLM: Failed constexpr");
|
||||
#endif
|
||||
|
||||
@@ -299,7 +299,7 @@ static int test_size()
|
||||
Error += glm::vec2::length() == 2 ? 0 : 1;
|
||||
Error += glm::dvec2::length() == 2 ? 0 : 1;
|
||||
|
||||
GLM_CONSTEXPR_CXX11 std::size_t Length = glm::vec2::length();
|
||||
GLM_CONSTEXPR std::size_t Length = glm::vec2::length();
|
||||
Error += Length == 2 ? 0 : 1;
|
||||
|
||||
return Error;
|
||||
@@ -334,7 +334,7 @@ static int test_operator_increment()
|
||||
|
||||
static int test_constexpr()
|
||||
{
|
||||
#if GLM_HAS_CONSTEXPR_CXX14
|
||||
#if GLM_HAS_CONSTEXPR
|
||||
static_assert(glm::vec2::length() == 2, "GLM: Failed constexpr");
|
||||
static_assert(glm::vec2(1.0f).x > 0.0f, "GLM: Failed constexpr");
|
||||
static_assert(glm::vec2(1.0f, -1.0f).x > 0.0f, "GLM: Failed constexpr");
|
||||
|
||||
@@ -307,7 +307,7 @@ int test_vec3_size()
|
||||
Error += glm::vec3::length() == 3 ? 0 : 1;
|
||||
Error += glm::dvec3::length() == 3 ? 0 : 1;
|
||||
|
||||
GLM_CONSTEXPR_CXX11 std::size_t Length = glm::vec3::length();
|
||||
GLM_CONSTEXPR std::size_t Length = glm::vec3::length();
|
||||
Error += Length == 3 ? 0 : 1;
|
||||
|
||||
return Error;
|
||||
@@ -595,7 +595,7 @@ static int test_swizzle()
|
||||
|
||||
static int test_constexpr()
|
||||
{
|
||||
#if GLM_HAS_CONSTEXPR_CXX14
|
||||
#if GLM_HAS_CONSTEXPR
|
||||
static_assert(glm::vec3::length() == 3, "GLM: Failed constexpr");
|
||||
static_assert(glm::vec3(1.0f).x > 0.0f, "GLM: Failed constexpr");
|
||||
static_assert(glm::vec3(1.0f) == glm::vec3(1.0f), "GLM: Failed constexpr");
|
||||
|
||||
@@ -749,7 +749,7 @@ static int test_inheritance()
|
||||
|
||||
static int test_constexpr()
|
||||
{
|
||||
#if GLM_HAS_CONSTEXPR_CXX14
|
||||
#if GLM_HAS_CONSTEXPR
|
||||
static_assert(glm::vec4::length() == 4, "GLM: Failed constexpr");
|
||||
static_assert(glm::vec4(1.0f).x > 0.0f, "GLM: Failed constexpr");
|
||||
static_assert(glm::vec4(1.0f) == glm::vec4(1.0f), "GLM: Failed constexpr");
|
||||
|
||||
@@ -76,7 +76,7 @@ static int test_vec1_size()
|
||||
Error += glm::vec1::length() == 1 ? 0 : 1;
|
||||
Error += glm::dvec1::length() == 1 ? 0 : 1;
|
||||
|
||||
GLM_CONSTEXPR_CXX11 std::size_t Length = glm::vec1::length();
|
||||
GLM_CONSTEXPR std::size_t Length = glm::vec1::length();
|
||||
Error += Length == 1 ? 0 : 1;
|
||||
|
||||
return Error;
|
||||
@@ -134,7 +134,7 @@ static int test_bvec1_ctor()
|
||||
|
||||
static int test_constexpr()
|
||||
{
|
||||
#if GLM_HAS_CONSTEXPR_CXX11
|
||||
#if GLM_HAS_CONSTEXPR
|
||||
static_assert(glm::vec1::length() == 1, "GLM: Failed constexpr");
|
||||
static_assert(glm::vec1(1.0f).x > 0.0f, "GLM: Failed constexpr");
|
||||
#endif
|
||||
|
||||
@@ -309,7 +309,7 @@ int test_size()
|
||||
|
||||
static int test_constexpr()
|
||||
{
|
||||
#if GLM_HAS_CONSTEXPR_CXX11
|
||||
#if GLM_HAS_CONSTEXPR
|
||||
static_assert(glm::quat::length() == 4, "GLM: Failed constexpr");
|
||||
static_assert(glm::quat(1.0f, glm::vec3(0.0f)).w > 0.0f, "GLM: Failed constexpr");
|
||||
#endif
|
||||
|
||||
@@ -95,7 +95,7 @@ static int test_ctor()
|
||||
{
|
||||
int Error = 0;
|
||||
|
||||
# if GLM_HAS_CONSTEXPR_CXX11
|
||||
# if GLM_HAS_CONSTEXPR
|
||||
{
|
||||
constexpr glm::aligned_ivec4 v(1);
|
||||
|
||||
@@ -122,7 +122,7 @@ static int test_ctor()
|
||||
Error += v.z == 1 ? 0 : 1;
|
||||
Error += v.w == 1 ? 0 : 1;
|
||||
}
|
||||
# endif//GLM_HAS_CONSTEXPR_CXX11
|
||||
# endif//GLM_HAS_CONSTEXPR
|
||||
|
||||
return Error;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user