diff --git a/src/Math/Test/VectorTest.cpp b/src/Math/Test/VectorTest.cpp index 24a1003ca..5d25b7b2d 100644 --- a/src/Math/Test/VectorTest.cpp +++ b/src/Math/Test/VectorTest.cpp @@ -154,13 +154,17 @@ void VectorTest::constExpressions() { constexpr Vector4 b(1.0f, 3.5f, 4.0f, -2.7f); CORRADE_COMPARE(b, Vector4(1.0f, 3.5f, 4.0f, -2.7f)); - /* One-value constructor */ + /* One-value constructor, not constexpr under GCC < 4.7 */ + #ifndef CORRADE_GCC46_COMPATIBILITY constexpr Vector4 c(7.0f); CORRADE_COMPARE(c, Vector4(7.0f, 7.0f, 7.0f, 7.0f)); + #endif - /* Conversion constructor */ + /* Conversion constructor, not constexpr under GCC < 4.7 */ + #ifndef CORRADE_GCC46_COMPATIBILITY constexpr Vector4i d(b); CORRADE_COMPARE(d, Vector4i(1, 3, 4, -2)); + #endif /* Copy constructor */ constexpr Vector4 e(b); diff --git a/src/Math/Vector.h b/src/Math/Vector.h index 833554cb8..d496abcce 100644 --- a/src/Math/Vector.h +++ b/src/Math/Vector.h @@ -118,7 +118,13 @@ template class Vector { #ifdef DOXYGEN_GENERATING_OUTPUT inline explicit Vector(T value); #else + #ifndef CORRADE_GCC46_COMPATIBILITY template::value && size != 1, T>::type> inline constexpr explicit Vector(U value): Vector(typename Implementation::GenerateSequence::Type(), value) {} + #else + template::value && size != 1, T>::type> inline explicit Vector(U value) { + *this = Vector(typename Implementation::GenerateSequence::Type(), value); + } + #endif #endif /** @@ -132,7 +138,13 @@ template class Vector { * // integral == {1, 2, -15, 7} * @endcode */ + #ifndef CORRADE_GCC46_COMPATIBILITY template inline constexpr explicit Vector(const Vector& other): Vector(typename Implementation::GenerateSequence::Type(), other) {} + #else + template inline explicit Vector(const Vector& other) { + *this = Vector(typename Implementation::GenerateSequence::Type(), other); + } + #endif /** @brief Copy constructor */ inline constexpr Vector(const Vector&) = default;