From a4a962f686800d2c93bcfdbf5e09a29c04a16488 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Thu, 9 May 2013 21:34:47 +0200 Subject: [PATCH] Math: fixed matrix tests (spotted by Clang). Either GCC 4.8 poorly implements C++11 or it already has support for some proposed C++14 feature, which allows to elide successive initializer braces. --- src/Math/Test/Matrix3Test.cpp | 12 ++++++------ src/Math/Test/Matrix4Test.cpp | 16 ++++++++-------- src/Math/Test/MatrixTest.cpp | 12 ++++++------ src/Math/Test/RectangularMatrixTest.cpp | 8 ++++---- 4 files changed, 24 insertions(+), 24 deletions(-) diff --git a/src/Math/Test/Matrix3Test.cpp b/src/Math/Test/Matrix3Test.cpp index cffdc11d0..6a5c91fb8 100644 --- a/src/Math/Test/Matrix3Test.cpp +++ b/src/Math/Test/Matrix3Test.cpp @@ -45,9 +45,9 @@ template<> struct RectangularMatrixConverter<3, 3, float, Mat3> { } inline constexpr static Mat3 to(const RectangularMatrix<3, 3, Float>& other) { - return Mat3{other[0][0], other[0][1], other[0][2], - other[1][0], other[1][1], other[1][2], - other[2][0], other[2][1], other[2][2]}; + return Mat3{{other[0][0], other[0][1], other[0][2], + other[1][0], other[1][1], other[1][2], + other[2][0], other[2][1], other[2][2]}}; } }; @@ -181,9 +181,9 @@ void Matrix3Test::constructCopy() { } void Matrix3Test::convert() { - constexpr Mat3 a{1.5f, 2.0f, -3.5f, - 2.0f, -3.1f, 0.4f, - 9.5f, -1.5f, 0.1f}; + constexpr Mat3 a{{1.5f, 2.0f, -3.5f, + 2.0f, -3.1f, 0.4f, + 9.5f, -1.5f, 0.1f}}; constexpr Matrix3 b(Vector3(1.5f, 2.0f, -3.5f), Vector3(2.0f, -3.1f, 0.4f), Vector3(9.5f, -1.5f, 0.1f)); diff --git a/src/Math/Test/Matrix4Test.cpp b/src/Math/Test/Matrix4Test.cpp index bc79ef964..2a18a20b0 100644 --- a/src/Math/Test/Matrix4Test.cpp +++ b/src/Math/Test/Matrix4Test.cpp @@ -46,10 +46,10 @@ template<> struct RectangularMatrixConverter<4, 4, float, Mat4> { } inline constexpr static Mat4 to(const RectangularMatrix<4, 4, Float>& other) { - return Mat4{other[0][0], other[0][1], other[0][2], other[0][3], - other[1][0], other[1][1], other[1][2], other[1][3], - other[2][0], other[2][1], other[2][2], other[2][3], - other[3][0], other[3][1], other[3][2], other[3][3]}; + return Mat4{{other[0][0], other[0][1], other[0][2], other[0][3], + other[1][0], other[1][1], other[1][2], other[1][3], + other[2][0], other[2][1], other[2][2], other[2][3], + other[3][0], other[3][1], other[3][2], other[3][3]}}; } }; @@ -203,10 +203,10 @@ void Matrix4Test::constructCopy() { } void Matrix4Test::convert() { - constexpr Mat4 a{3.0f, 5.0f, 8.0f, -3.0f, - 4.5f, 4.0f, 7.0f, 2.0f, - 1.0f, 2.0f, 3.0f, -1.0f, - 7.9f, -1.0f, 8.0f, -1.5f}; + constexpr Mat4 a{{3.0f, 5.0f, 8.0f, -3.0f, + 4.5f, 4.0f, 7.0f, 2.0f, + 1.0f, 2.0f, 3.0f, -1.0f, + 7.9f, -1.0f, 8.0f, -1.5f}}; constexpr Matrix4 b({3.0f, 5.0f, 8.0f, -3.0f}, {4.5f, 4.0f, 7.0f, 2.0f}, {1.0f, 2.0f, 3.0f, -1.0f}, diff --git a/src/Math/Test/MatrixTest.cpp b/src/Math/Test/MatrixTest.cpp index f22f2934b..efc2282cc 100644 --- a/src/Math/Test/MatrixTest.cpp +++ b/src/Math/Test/MatrixTest.cpp @@ -45,9 +45,9 @@ template<> struct RectangularMatrixConverter<3, 3, float, Mat3> { } inline constexpr static Mat3 to(const RectangularMatrix<3, 3, Float>& other) { - return Mat3{other[0][0], other[0][1], other[0][2], - other[1][0], other[1][1], other[1][2], - other[2][0], other[2][1], other[2][2]}; + return Mat3{{other[0][0], other[0][1], other[0][2], + other[1][0], other[1][1], other[1][2], + other[2][0], other[2][1], other[2][2]}}; } }; @@ -179,9 +179,9 @@ void MatrixTest::constructCopy() { } void MatrixTest::convert() { - constexpr Mat3 a{1.5f, 2.0f, -3.5f, - 2.0f, -3.1f, 0.4f, - 9.5f, -1.5f, 0.1f}; + constexpr Mat3 a{{1.5f, 2.0f, -3.5f, + 2.0f, -3.1f, 0.4f, + 9.5f, -1.5f, 0.1f}}; constexpr Matrix3 b(Vector3(1.5f, 2.0f, -3.5f), Vector3(2.0f, -3.1f, 0.4f), Vector3(9.5f, -1.5f, 0.1f)); diff --git a/src/Math/Test/RectangularMatrixTest.cpp b/src/Math/Test/RectangularMatrixTest.cpp index 48b2ecee3..e05e2e036 100644 --- a/src/Math/Test/RectangularMatrixTest.cpp +++ b/src/Math/Test/RectangularMatrixTest.cpp @@ -44,8 +44,8 @@ template<> struct RectangularMatrixConverter<2, 3, float, Mat2x3> { } inline constexpr static Mat2x3 to(const RectangularMatrix<2, 3, Float>& other) { - return Mat2x3{other[0][0], other[0][1], other[0][2], - other[1][0], other[1][1], other[1][2]}; + return Mat2x3{{other[0][0], other[0][1], other[0][2], + other[1][0], other[1][1], other[1][2]}}; } }; @@ -195,8 +195,8 @@ void RectangularMatrixTest::constructCopy() { void RectangularMatrixTest::convert() { typedef RectangularMatrix<2, 3, Float> Matrix2x3; - constexpr Mat2x3 a{1.5f, 2.0f, -3.5f, - 2.0f, -3.1f, 0.4f}; + constexpr Mat2x3 a{{1.5f, 2.0f, -3.5f, + 2.0f, -3.1f, 0.4f}}; constexpr Matrix2x3 b(Vector3(1.5f, 2.0f, -3.5f), Vector3(2.0f, -3.1f, 0.4f));