diff --git a/src/Math/Test/VectorTest.cpp b/src/Math/Test/VectorTest.cpp index dc6b94449..b8069ffb2 100644 --- a/src/Math/Test/VectorTest.cpp +++ b/src/Math/Test/VectorTest.cpp @@ -201,10 +201,18 @@ void VectorTest::convert() { constexpr Vec3 a{1.5f, 2.0f, -3.5f}; constexpr Vector3 b(1.5f, 2.0f, -3.5f); + #ifndef CORRADE_GCC46_COMPATIBILITY constexpr Vector3 c(a); + #else + Vector3 c(a); /* Not constexpr under GCC < 4.7 */ + #endif CORRADE_COMPARE(c, b); + #ifndef CORRADE_GCC46_COMPATIBILITY constexpr Vec3 d(b); + #else + Vec3 d(b); /* Not constexpr under GCC < 4.7 */ + #endif CORRADE_COMPARE(d.x, a.x); CORRADE_COMPARE(d.y, a.y); CORRADE_COMPARE(d.z, a.z); diff --git a/src/Math/Vector.h b/src/Math/Vector.h index 5ef5b508a..9e333dfdc 100644 --- a/src/Math/Vector.h +++ b/src/Math/Vector.h @@ -162,7 +162,13 @@ template class Vector { #endif /** @brief Construct vector from external representation */ + #ifndef CORRADE_GCC46_COMPATIBILITY template::from(std::declval()))> inline constexpr explicit Vector(const U& other): Vector(Implementation::VectorConverter::from(other)) {} + #else + template::from(std::declval()))> inline explicit Vector(const U& other) { + *this = Vector(Implementation::VectorConverter::from(other)); + } + #endif /** @brief Copy constructor */ inline constexpr Vector(const Vector&) = default; @@ -172,6 +178,7 @@ template class Vector { /** @brief Convert vector to external representation */ template::to(std::declval>()))> inline constexpr explicit operator U() const { + /** @bug Why this is not constexpr under GCC 4.6? */ return Implementation::VectorConverter::to(*this); }