diff --git a/src/Magnum/Math/Test/ComplexTest.cpp b/src/Magnum/Math/Test/ComplexTest.cpp index 32ab90a1b..7009a725b 100644 --- a/src/Magnum/Math/Test/ComplexTest.cpp +++ b/src/Magnum/Math/Test/ComplexTest.cpp @@ -38,7 +38,10 @@ namespace Magnum { namespace Math { namespace Implementation { template<> struct ComplexConverter { - constexpr static Complex from(const Cmpl& other) { + #if !defined(__GNUC__) || defined(__clang__) + constexpr /* See the convert() test case */ + #endif + static Complex from(const Cmpl& other) { return {other.re, other.im}; } @@ -164,7 +167,13 @@ void ComplexTest::convert() { constexpr Cmpl a{1.5f, -3.5f}; constexpr Complex b{1.5f, -3.5f}; - constexpr Complex c(a); + /* GCC 5.1 fills the result with zeros instead of properly calling + delegated copy constructor if using constexpr. Reported here: + https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66450 */ + #if !defined(__GNUC__) || defined(__clang__) + constexpr + #endif + Complex c(a); CORRADE_COMPARE(c, b); constexpr Cmpl d(b); diff --git a/src/Magnum/Math/Test/DualComplexTest.cpp b/src/Magnum/Math/Test/DualComplexTest.cpp index 036205f7b..b2a9917e5 100644 --- a/src/Magnum/Math/Test/DualComplexTest.cpp +++ b/src/Magnum/Math/Test/DualComplexTest.cpp @@ -38,7 +38,10 @@ namespace Magnum { namespace Math { namespace Implementation { template<> struct DualComplexConverter { - constexpr static DualComplex from(const DualCmpl& other) { + #if !defined(__GNUC__) || defined(__clang__) + constexpr /* See the convert() test case */ + #endif + static DualComplex from(const DualCmpl& other) { return {{other.re, other.im}, {other.x, other.y}}; } @@ -158,7 +161,13 @@ void DualComplexTest::convert() { constexpr DualCmpl a{1.5f, -3.5f, 7.0f, -0.5f}; constexpr DualComplex b{{1.5f, -3.5f}, {7.0f, -0.5f}}; - constexpr DualComplex c{a}; + /* GCC 5.1 fills the result with zeros instead of properly calling + delegated copy constructor if using constexpr. Reported here: + https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66450 */ + #if !defined(__GNUC__) || defined(__clang__) + constexpr + #endif + DualComplex c{a}; CORRADE_COMPARE(c, b); constexpr DualCmpl d(b); diff --git a/src/Magnum/Math/Test/DualQuaternionTest.cpp b/src/Magnum/Math/Test/DualQuaternionTest.cpp index f5c6efa8b..4f4c2892b 100644 --- a/src/Magnum/Math/Test/DualQuaternionTest.cpp +++ b/src/Magnum/Math/Test/DualQuaternionTest.cpp @@ -38,7 +38,10 @@ namespace Magnum { namespace Math { namespace Implementation { template<> struct DualQuaternionConverter { - constexpr static DualQuaternion from(const DualQuat& other) { + #if !defined(__GNUC__) || defined(__clang__) + constexpr /* See the convert() test case */ + #endif + static DualQuaternion from(const DualQuat& other) { return {{{other.re.x, other.re.y, other.re.z}, other.re.w}, {{other.du.x, other.du.y, other.du.z}, other.du.w}}; } @@ -159,7 +162,13 @@ void DualQuaternionTest::convert() { constexpr DualQuat a{{1.5f, -3.5f, 7.0f, -0.5f}, {15.0f, 0.25f, -9.5f, 0.8f}}; constexpr DualQuaternion b{{{1.5f, -3.5f, 7.0f}, -0.5f}, {{15.0f, 0.25f, -9.5f}, 0.8f}}; - constexpr DualQuaternion c{a}; + /* GCC 5.1 fills the result with zeros instead of properly calling + delegated copy constructor if using constexpr. Reported here: + https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66450 */ + #if !defined(__GNUC__) || defined(__clang__) + constexpr + #endif + DualQuaternion c{a}; CORRADE_COMPARE(c, b); constexpr DualQuat d(b); diff --git a/src/Magnum/Math/Test/QuaternionTest.cpp b/src/Magnum/Math/Test/QuaternionTest.cpp index 115061eb1..45ac12d17 100644 --- a/src/Magnum/Math/Test/QuaternionTest.cpp +++ b/src/Magnum/Math/Test/QuaternionTest.cpp @@ -38,7 +38,10 @@ namespace Magnum { namespace Math { namespace Implementation { template<> struct QuaternionConverter { - constexpr static Quaternion from(const Quat& other) { + #if !defined(__GNUC__) || defined(__clang__) + constexpr /* See the convert() test case */ + #endif + static Quaternion from(const Quat& other) { return {{other.x, other.y, other.z}, other.w}; } @@ -165,7 +168,13 @@ void QuaternionTest::convert() { constexpr Quat a{1.5f, -3.5f, 7.0f, -0.5f}; constexpr Quaternion b{{1.5f, -3.5f, 7.0f}, -0.5f}; - constexpr Quaternion c{a}; + /* GCC 5.1 fills the result with zeros instead of properly calling + delegated copy constructor if using constexpr. Reported here: + https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66450 */ + #if !defined(__GNUC__) || defined(__clang__) + constexpr + #endif + Quaternion c{a}; CORRADE_COMPARE(c, b); constexpr Quat d(b); diff --git a/src/Magnum/Math/Test/RectangularMatrixTest.cpp b/src/Magnum/Math/Test/RectangularMatrixTest.cpp index e09fd0d85..75f84b404 100644 --- a/src/Magnum/Math/Test/RectangularMatrixTest.cpp +++ b/src/Magnum/Math/Test/RectangularMatrixTest.cpp @@ -38,7 +38,10 @@ namespace Magnum { namespace Math { namespace Implementation { template<> struct RectangularMatrixConverter<2, 3, Float, Mat2x3> { - constexpr static RectangularMatrix<2, 3, Float> from(const Mat2x3& other) { + #if !defined(__GNUC__) || defined(__clang__) + constexpr /* See the convert() test case */ + #endif + static RectangularMatrix<2, 3, Float> from(const Mat2x3& other) { return RectangularMatrix<2, 3, Float>( Vector<3, Float>(other.a[0], other.a[1], other.a[2]), Vector<3, Float>(other.a[3], other.a[4], other.a[5])); @@ -211,7 +214,13 @@ void RectangularMatrixTest::convert() { constexpr Matrix2x3 b(Vector3(1.5f, 2.0f, -3.5f), Vector3(2.0f, -3.1f, 0.4f)); - constexpr Matrix2x3 c{a}; + /* GCC 5.1 fills the result with zeros instead of properly calling + delegated copy constructor if using constexpr. Reported here: + https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66450 */ + #if !defined(__GNUC__) || defined(__clang__) + constexpr + #endif + Matrix2x3 c{a}; CORRADE_COMPARE(c, b); constexpr Mat2x3 d(b); diff --git a/src/Magnum/Math/Test/VectorTest.cpp b/src/Magnum/Math/Test/VectorTest.cpp index 02807ff22..bdd1cf5f6 100644 --- a/src/Magnum/Math/Test/VectorTest.cpp +++ b/src/Magnum/Math/Test/VectorTest.cpp @@ -38,7 +38,10 @@ namespace Magnum { namespace Math { namespace Implementation { template<> struct VectorConverter<3, Float, Vec3> { - constexpr static Vector<3, Float> from(const Vec3& other) { + #if !defined(__GNUC__) || defined(__clang__) + constexpr /* See the convert() test case */ + #endif + static Vector<3, Float> from(const Vec3& other) { return {other.x, other.y, other.z}; } @@ -224,7 +227,13 @@ void VectorTest::convert() { constexpr Vec3 a{1.5f, 2.0f, -3.5f}; constexpr Vector3 b(1.5f, 2.0f, -3.5f); - constexpr Vector3 c{a}; + /* GCC 5.1 fills the result with zeros instead of properly calling + delegated copy constructor if using constexpr. Reported here: + https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66450 */ + #if !defined(__GNUC__) || defined(__clang__) + constexpr + #endif + Vector3 c{a}; CORRADE_COMPARE(c, b); constexpr Vec3 d(b);